What is the default value of AR's `include_root_in_json` ? #9459

khustochka opened this Issue Feb 27, 2013 · 5 comments


None yet
3 participants

khustochka commented Feb 27, 2013

In wrap_parameters.rb template there are lines:

# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
#  self.include_root_in_json = true
# end

This is formulated in a way that makes user think it is disabled by default, and you have to uncomment the lines to enable it.

But actually it is enabled by default:

    included do
      self.include_root_in_json = true

Is it OK to change the initializer template?


senny commented Feb 27, 2013

this definitely feels strange.

@rafaelfranca @carlosantoniodasilva do you know what changed here?

Yes, I think so, the default include_root_in_json has been changed in master, so the initializer is outdated.


senny commented Feb 27, 2013

should we change the initializer to say = false or remove it?

Hm actually, it's Active Model that has changed, here: ab11a27


khustochka commented Feb 27, 2013

yes, AM's default is false, but AR's default is true

senny closed this in 8c7d401 Mar 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment