Put a new file in your initializers with this code below and see if it
helps:
module ActiveResource
class Base
self.include_root_in_json = false
end
module Formats
module JsonFormat
def decode(json)
ActiveSupport::JSON.decode(json)
end
end
end
end
module ActiveModel
module Serializers
module JSON
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)
hash = ActiveSupport::JSON.decode(json)
hash = hash.values.first if include_root_in_json
self.attributes = hash
self
end
end
end
end
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/cXrRFRCQ59EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.