Override as_json or to_json model class name
Posted
by Jack
on Stack Overflow
See other posts from Stack Overflow
or by Jack
Published on 2010-03-31T21:08:05Z
Indexed on
2010/04/02
14:03 UTC
Read the original article
Hit count: 210
ruby-on-rails
I'd like to modify the classname when calling to_json on an AR model.
i.e.
Book.first.to_json
#=> "{\"book\":{\"created_at\":\"2010-03-23
Book.first.to_json(:root => 'libro')
#=> "{\"libro\":{\"created_at\":\"2010-03-23
Is there an option to do this?
© Stack Overflow or respective owner