Skip to content
Browse files

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.
  • Loading branch information...
1 parent 3594102 commit 458128df79b4ed65c2684d3556e8195f11e77eda @jonleighton jonleighton committed Aug 16, 2011
View
12 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

0 comments on commit 458128d

Please sign in to comment.
Something went wrong with that request. Please try again.