Skip to content

Commit

Permalink
Rename process_resource into resource_objects_for.
Browse files Browse the repository at this point in the history
  • Loading branch information
beauby committed Oct 26, 2015
1 parent 206f890 commit 6facf88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/active_model/serializer/adapter/json_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def initialize(serializer, options = {})
def serializable_hash(options = nil)
options ||= {}

resources = process_resource(serializer)
resources = resource_objects_for(serializer)
primary_data, included = resources.each_with_object([[], []]) do |(_, resource), (prim, incl)|
is_primary = resource.delete(:is_primary)
if is_primary
Expand Down Expand Up @@ -93,9 +93,9 @@ def fragment_cache(cached_hash, non_cached_hash)
# on included associations.
#
# @api private
def process_resource(serializer, include_tree = @include_tree, is_primary = true, hashes = {})
def resource_objects_for(serializer, include_tree = @include_tree, is_primary = true, hashes = {})
if serializer.respond_to?(:each)
serializer.each { |s| process_resource(s, include_tree, is_primary, hashes) }
serializer.each { |s| resource_objects_for(s, include_tree, is_primary, hashes) }
return hashes
end

Expand All @@ -110,7 +110,7 @@ def process_resource(serializer, include_tree = @include_tree, is_primary = true
hashes[key] = resource_object_for(serializer).merge(is_primary: is_primary)

serializer.associations(include_tree).each do |association|
process_resource(association.serializer, include_tree[association.key], false, hashes)
resource_objects_for(association.serializer, include_tree[association.key], false, hashes)
end

hashes
Expand Down

0 comments on commit 6facf88

Please sign in to comment.