Extract attributes filtering from serializer into adapter.

This commit is contained in:
Lucas Hosseini
2015-10-05 06:08:11 +02:00
parent 066990184b
commit 658810e6a0
8 changed files with 35 additions and 59 deletions

View File

@@ -148,13 +148,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