I am using Ruby on Rails 3 and I would like to override the to_json method.
At this time, I use the following code to avoid exporting important information.
def to_json super( :except => [ :password ] ) end
If I need to change a value using this method, how can I do this?
For example, I would like to use a username
:name => name.capitalize
when retrieving this
@user.to_json
json override ruby ruby-on-rails ruby-on-rails-3
user502052
source share