mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
changes to be able to specify multiple attributes with keys
This commit is contained in:
@@ -69,10 +69,15 @@ module ActiveModel
|
||||
class << self
|
||||
# Define attributes to be used in the serialization.
|
||||
def attributes(*attrs)
|
||||
|
||||
self._attributes = _attributes.dup
|
||||
|
||||
attrs.each do |attr|
|
||||
attribute attr
|
||||
if Hash === attr
|
||||
attr.each {|attr_real, key| attribute attr_real, :key => key }
|
||||
else
|
||||
attribute attr
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user