Skip to content
Browse files

Setup ActiveRecord QueryCache middleware in the initializer

  • Loading branch information...
1 parent 82334a7 commit 73cc5f270a5c2a2eab76c6c02615fec608822494 @josh josh committed Jan 21, 2009
Showing with 4 additions and 5 deletions.
  1. +3 −5 actionpack/lib/action_controller/middlewares.rb
  2. +1 −0 railties/lib/initializer.rb
View
8 actionpack/lib/action_controller/middlewares.rb
@@ -4,8 +4,6 @@
use "ActionController::Failsafe"
-use "ActiveRecord::QueryCache", :if => lambda { defined?(ActiveRecord) }
-
["ActionController::Session::CookieStore",
"ActionController::Session::MemCacheStore",
"ActiveRecord::SessionStore"].each do |store|
@@ -18,6 +16,6 @@
)
end
-use ActionController::RewindableInput
-use ActionController::ParamsParser
-use Rack::MethodOverride
+use "ActionController::RewindableInput"
+use "ActionController::ParamsParser"
+use "Rack::MethodOverride"
View
1 railties/lib/initializer.rb
@@ -408,6 +408,7 @@ def initialize_database
if configuration.frameworks.include?(:active_record)
ActiveRecord::Base.configurations = configuration.database_configuration
ActiveRecord::Base.establish_connection
+ configuration.middleware.use ActiveRecord::QueryCache
end
end

0 comments on commit 73cc5f2

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