Update Rubocop todo

This commit is contained in:
Benjamin Fleischer
2015-09-20 17:57:01 -05:00
parent ca6b193fcb
commit 140b4f2735
3 changed files with 22 additions and 75 deletions

View File

@@ -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)

View File

@@ -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