mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
@@ -132,7 +132,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
|
||||
|
||||
Reference in New Issue
Block a user