method

from_json

Importance_1
Ruby on Rails latest stable (v2.3.4) - 1 note - Class: ActiveRecord::Serialization
from_json(json) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
July 24, 2009
0 thanks

Instance method

Please note that this is an instance method, not a class method (which seemed more logical for me and took me a while to see what’s wrong). So, you call it like this:

  User.new.from_json '{"id": 1, "name": "DHH"}' # RIGHT!

not like this:

  User.from_json '{"id": 1, "name": "DHH"}' # WRONG!