mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Refactor relationships_for.
This commit is contained in:
parent
c593adbcb2
commit
a8a0566d29
@ -109,12 +109,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def relationships_for(serializer)
|
||||
relationships = {}
|
||||
serializer.associations.each do |association|
|
||||
value = relationship_value_for(association.serializer, association.options)
|
||||
relationships[association.key] = { data: value }
|
||||
end
|
||||
relationships
|
||||
serializer.associations.map { |association| [ association.key, { data: relationship_value_for(association.serializer, association.options) } ] }.to_h
|
||||
end
|
||||
|
||||
def included_for(serializer)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user