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

Closed
khustochka opened this Issue Feb 27, 2013 · 5 comments

Comments

Projects
None yet
3 participants
Contributor

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:

#.../gems/activerecord-4.0.0.beta1/lib/active_record/serialization.rb
    included do
      self.include_root_in_json = true
    end

Is it OK to change the initializer template?

Member

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.

Member

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

Contributor

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