Merge pull request #1232 from beauby/move-root-to-adapter

Extract attributes filtering from serializer into adapter.
This commit is contained in:
L. Preston Sego III
2015-10-05 12:56:54 -04:00
8 changed files with 35 additions and 59 deletions

View File

@@ -144,13 +144,8 @@ module ActiveModel
root || object.class.model_name.to_s.underscore
end
def attributes(options = {})
attributes =
if options[:fields]
self.class._attributes & options[:fields]
else
self.class._attributes.dup
end
def attributes
attributes = self.class._attributes.dup
attributes.each_with_object({}) do |name, hash|
unless self.class._fragmented