josevalim/active_model_serializers — pull request #14 by lostinpatterns (2011-12-14 22:23:06+00:00)
Title: added in attribute methods to serializer

Allowing you to specify the names of methods on your serializer to be included as attributes. Any presentation logic for the serializer belongs in the serializer, not the model. Eg:

```ruby
class UserSerializer < ActiveModel::Serializer

attributes :id, :first_name, :full_name

def first_name
user.first_name.upcase
end

def full_name
[user.first_name, user.last_name].join(' ')
end

end
```

Thoughts?