Add Overriding attribute methods section to README.

This commit is contained in:
Alex Stophel 2015-02-07 00:09:50 -05:00
parent 5680436f9e
commit 13243f2e70

View File

@ -163,6 +163,22 @@ class PostSerializer < ActiveModel::Serializer
end 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 ### Built in Adapters
#### JSONAPI #### JSONAPI