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 | 10 |
1 files changed, 7 insertions, 3 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 fa1548db8b..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 @@ -4,9 +4,13 @@ # 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 -%> |