mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Update Rubocop todo
This commit is contained in:
@@ -130,11 +130,14 @@ module ActiveModel
|
||||
end
|
||||
end
|
||||
|
||||
def included_for(serializer)
|
||||
included.flat_map do |inc|
|
||||
association = serializer.associations.find { |assoc| assoc.key == inc.first }
|
||||
_included_for(association.serializer, inc.second) if association
|
||||
end.uniq
|
||||
def included_resources(include_tree)
|
||||
included = []
|
||||
|
||||
serializer.associations(include_tree).each do |association|
|
||||
add_included_resources_for(association.serializer, include_tree[association.key], included)
|
||||
end
|
||||
|
||||
included
|
||||
end
|
||||
|
||||
def add_included_resources_for(serializer, include_tree, included)
|
||||
|
||||
@@ -16,9 +16,9 @@ module ActiveModel
|
||||
when Symbol
|
||||
{ included => {} }
|
||||
when Hash
|
||||
included.each_with_object({}) { |(key, value), hash|
|
||||
included.each_with_object({}) do |(key, value), hash|
|
||||
hash[key] = include_args_to_hash(value)
|
||||
}
|
||||
end
|
||||
when Array
|
||||
included.reduce({}) { |a, e| a.merge!(include_args_to_hash(e)) }
|
||||
when String
|
||||
|
||||
Reference in New Issue
Block a user