We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
attribute
attributes
1 parent 64168cb commit 995bbccCopy full SHA for 995bbcc
lib/active_model/serializer.rb
@@ -70,7 +70,7 @@ def self.attribute(attr, options = {})
70
ActiveModelSerializers.silence_warnings do
71
define_method key do
72
object.read_attribute_for_serialization(attr)
73
- end unless respond_to?(key, false) || _fragmented.respond_to?(attr)
+ end unless (key != :id && method_defined?(key)) || _fragmented.respond_to?(attr)
74
end
75
76
test/fixtures/poro.rb
@@ -134,7 +134,8 @@ def custom_options
134
135
AuthorSerializer = Class.new(ActiveModel::Serializer) do
136
cache key:'writer', skip_digest: true
137
- attributes :id, :name
+ attribute :id
138
+ attribute :name
139
140
has_many :posts, embed: :ids
141
has_many :roles, embed: :ids
0 commit comments