Attributes
::attributes
Serialization of the resource title and body
| In Serializer | #attributes |
|---|---|
attributes :title, :body |
{ title: 'Some Title', body: 'Some Body' } |
attributes :title, :bodydef body "Special #{object.body}" end |
{ title: 'Some Title', body: 'Special Some Body' } |
::attribute
Serialization of the resource title
| In Serializer | #attributes |
|---|---|
attribute :title |
{ title: 'Some Title' } |
attribute :title, key: :name |
{ name: 'Some Title' } |
attribute :title { 'A Different Title'} |
{ title: 'A Different Title' } |
attribute :titledef title 'A Different Title' end |
{ title: 'A Different Title' } |