This commit is contained in:
Aaron Renoir
2014-10-26 13:04:14 -07:00
parent 47deb87e81
commit 39bee48ae6
7 changed files with 113 additions and 3 deletions

View File

@@ -124,7 +124,14 @@ module ActiveModel
end
def attributes(options = {})
self.class._attributes.dup.each_with_object({}) do |name, hash|
attributes =
if options[:fields]
self.class._attributes & options[:fields]
else
self.class._attributes.dup
end
attributes.each_with_object({}) do |name, hash|
hash[name] = send(name)
end
end