RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Should I override to_json in my model?

In the “old days”, you’d override to_json in your model class to provide a custom JSON representation. In Rails 3, there’s a better way. And it’s available in 2.3.3 as well! Meet as_json, and why you should never override to_json ever again.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in