module ActiveModel::Serializers::JSON
def as_json(options = nil)
def as_json(options = nil) hash = serializable_hash(options) if include_root_in_json custom_root = options && options[:root] hash = { custom_root || self.class.model_name.element => hash } end hash end
def from_json(json)
def from_json(json) hash = ActiveSupport::JSON.decode(json) hash = hash.values.first if include_root_in_json self.attributes = hash self end