Merge pull request #807 from alexstophel/update-readme

Add Overriding attribute methods section to README.
This commit is contained in:
Guillermo Iguaran 2015-02-07 17:16:34 -05:00
commit a8243761fe

View File

@ -163,6 +163,22 @@ class PostSerializer < ActiveModel::Serializer
end
```
### Overriding attribute methods
If you want to override any attribute, you can use:
```ruby
class PostSerializer < ActiveModel::Serializer
attributes :id, :body
has_many :comments
def body
object.body.downcase
end
end
```
### Built in Adapters
#### JSONAPI