lib/lazy_resource/relation.rb in lazy_resource-0.3.3 vs lib/lazy_resource/relation.rb in lazy_resource-0.4.0
- old
+ new
@@ -40,13 +40,13 @@
end
def load(objects)
@fetched = true
- if @klass.root_node_name && objects.respond_to?(:key?) && objects.key?(@klass.root_node_name.to_s)
- other_objects = objects.dup
- objects = other_objects.delete(@klass.root_node_name.to_s)
- @other_attributes = other_objects
+ if mapped_name = @klass.mapped_root_node_name(objects)
+ other_attributes = objects.dup
+ objects = other_attributes.delete(mapped_name)
+ @other_attributes = other_attributes
end
@result = objects.map do |object|
@klass.load(object)
end