diff options
Diffstat (limited to 'railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt index e56195da80..d640f578da 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt @@ -1,12 +1,16 @@ # Be sure to restart your server when you modify this file. # -# This file contains the settings for ActionController::ParametersWrapper -# which will be enabled by default in the upcoming version of Ruby on Rails. +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActionController::Base.wrap_parameters <%= key_value :format, "[:json]" %> +ActiveSupport.on_load(:action_controller) do + wrap_parameters <%= key_value :format, "[:json]" %> +end +<%- unless options.skip_active_record? -%> # Disable root element in JSON by default. -if defined?(ActiveRecord) - ActiveRecord::Base.include_root_in_json = false +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false end +<%- end -%> |