diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-08-16 15:13:57 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-08-16 16:40:38 +0100 |
commit | 4dd985ae9514fdb9688eab780d881decff8358fa (patch) | |
tree | 121f3141583ff829a3a63c95e51553fb6387efab /railties | |
parent | 0d5a6f68dfb930816392f9711f0a6a52872bc72f (diff) | |
download | rails-4dd985ae9514fdb9688eab780d881decff8358fa.tar.gz rails-4dd985ae9514fdb9688eab780d881decff8358fa.tar.bz2 rails-4dd985ae9514fdb9688eab780d881decff8358fa.zip |
Don't reference ActiveRecord::Base in initializers/wrap_parameters.rb. Use config.active_record instead. This yields about a 20% decrease in startup time because it means that the connection is not created immediately on startup. Of course, this is only useful if you are not going to immediately use the database after startup.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt | 12 |
1 files changed, 7 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 a52917351d..b7b344a62d 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 @@ -3,10 +3,12 @@ # 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. -<%= app_const %>.config.wrap_parameters = { <%= key_value :format, "[:json]" %> } +<%= app_const %>.configure do + # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. + config.action_controller.wrap_parameters = { <%= key_value :format, "[:json]" %> } -# Disable root element in JSON by default. -if defined?(ActiveRecord) - ActiveRecord::Base.include_root_in_json = false + <%- unless options.skip_active_record? -%> + # Disable root element in JSON by default. + config.active_record.include_root_in_json = false + <%- end -%> end |