I'm using Rails 3 w/ Mongoid, (so no ActiveRecord). Mongoid uses ActiveModel's "to_json" method, and by default that method includes the root object in the JSON (which I don't want).
I've tried putting this in an initializer:
ActiveModel::Base.include_root_in_json = false
But get the error
uninitialized constant ActiveModel::Base
Any ideas how I can change this? I changed the default directly in the source-code and it worked fine, but obviously I'd like to do it properly.
The variable is defined at the top of this file: Github - activemodel/lib/active_model/serializers/json.rb
From the docs: "The option ActiveModel::Base.include_root_in_json controls the top-level behavior of to_json. It is true by default."