diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2013-11-05 19:22:03 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2013-11-05 19:22:03 -0800 |
commit | 134c1156dd5713da41c62ff798fe3979723e64cc (patch) | |
tree | 6e7f9540dafbec02d4ca6c2a7e75c637d86e1f1c /actionpack/lib/abstract_controller/base.rb | |
parent | 44406d1e77061ce22effaae4698918c1f9f6271a (diff) | |
download | rails-134c1156dd5713da41c62ff798fe3979723e64cc.tar.gz rails-134c1156dd5713da41c62ff798fe3979723e64cc.tar.bz2 rails-134c1156dd5713da41c62ff798fe3979723e64cc.zip |
Fixed Object#as_json and Struct#as_json with options
These methods now takes the same options as Hash#as_json, for example:
struct = Struct.new(:foo, :bar).new
struct.foo = "hello"
struct.bar = "world"
json = struct.as_json(only: [:foo]) # => {foo: "hello"}
This is extracted from PR #11728 from @sergiocampama, see also the
discussion in #11460.
Diffstat (limited to 'actionpack/lib/abstract_controller/base.rb')
0 files changed, 0 insertions, 0 deletions