mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Fix definition of serializer attributes with multiple calls to attribute instead of one single call to attributes.
This commit is contained in:
parent
64168cbecd
commit
995bbcc18d
@ -70,7 +70,7 @@ module ActiveModel
|
||||
ActiveModelSerializers.silence_warnings do
|
||||
define_method key do
|
||||
object.read_attribute_for_serialization(attr)
|
||||
end unless respond_to?(key, false) || _fragmented.respond_to?(attr)
|
||||
end unless (key != :id && method_defined?(key)) || _fragmented.respond_to?(attr)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
3
test/fixtures/poro.rb
vendored
3
test/fixtures/poro.rb
vendored
@ -134,7 +134,8 @@ end
|
||||
|
||||
AuthorSerializer = Class.new(ActiveModel::Serializer) do
|
||||
cache key:'writer', skip_digest: true
|
||||
attributes :id, :name
|
||||
attribute :id
|
||||
attribute :name
|
||||
|
||||
has_many :posts, embed: :ids
|
||||
has_many :roles, embed: :ids
|
||||
|
||||
Loading…
Reference in New Issue
Block a user