There's a difference between ActiveModel 3.0.* and ActiveModel 3.2.*
ActiveModel 3.0.*
----------
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
end
end
end
ActiveModel 3.2.*
----------
module ActiveModel
module Serializers
module JSON
def as_json(options = nil)
root = include_root_in_json
root = options[:root] if options.try(:key?, :root)
if root
root = self.class.model_name.element if root == true
{ root => serializable_hash(options) }
else
serializable_hash(options)
end
end
end
end
end
I think this has something to do with it. Apologies if I set you on a wild
goose chase.
On Saturday, March 3, 2012 3:21:10 AM UTC-5, Mark Peterson wrote:
>
> Which version of ActiveResource are you using? I also encounter what you
> are encountering while using ActiveResource 3.2.1.
>
> In 3.0.* there was "ActiveResource::Base.include_root_in_json" which you
> could set to false. I am not positive if that's the exact stumbling point,
> but it feels like it is.
>
>
>
--
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/-/qFMlHrzBHhkJ.
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.