diff options
author | Nicolás Hock Isaza <nhocki@gmail.com> | 2011-09-29 20:07:19 -0500 |
---|---|---|
committer | Nicolás Hock Isaza <nhocki@gmail.com> | 2011-09-29 21:44:23 -0500 |
commit | da914fa35c014b7753e609e25c6a45d3cda11274 (patch) | |
tree | aef75e5afe3ddcd57d3e143981e8125825d3fd1a /activerecord/lib/active_record/result.rb | |
parent | d2888de5985c7018a5be23d44143ec3c6cef9032 (diff) | |
download | rails-da914fa35c014b7753e609e25c6a45d3cda11274.tar.gz rails-da914fa35c014b7753e609e25c6a45d3cda11274.tar.bz2 rails-da914fa35c014b7753e609e25c6a45d3cda11274.zip |
Fixing `as_json` method for ActiveRecord models.
When you've got an AR Model and you override the `as_json` method,
you should be able to add default options to the renderer, like this:
class User < ActiveRecord::Base
def as_json(options = {})
super(options.merge(:except => [:password_digest]))
end
end
This was not possible before this commit. See the added test case.
Diffstat (limited to 'activerecord/lib/active_record/result.rb')
0 files changed, 0 insertions, 0 deletions