How can i set include_root_in_json to false for all my RoR models?
I've tried to set ActiveModel::Base.include_root_in_json = false inside application.rb, but it has no effect.
Model.to_json method is used to returns a JSON string representing the model and i have used self.include_root_in_json = false in a model itself.
But for the whole application you can try setting ActiveModel::Base.include_root_in_json = false in an initializer.[edit This does not work.]
[edit] ActiveRecord::Base.include_root_in_json = true try adding this line to config/environment.rb file.