Skip to content

Commit

Permalink
Setup ActiveRecord QueryCache middleware in the initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 21, 2009
1 parent 82334a7 commit 73cc5f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions actionpack/lib/action_controller/middlewares.rb
Expand Up @@ -4,8 +4,6 @@


use "ActionController::Failsafe" use "ActionController::Failsafe"


use "ActiveRecord::QueryCache", :if => lambda { defined?(ActiveRecord) }

["ActionController::Session::CookieStore", ["ActionController::Session::CookieStore",
"ActionController::Session::MemCacheStore", "ActionController::Session::MemCacheStore",
"ActiveRecord::SessionStore"].each do |store| "ActiveRecord::SessionStore"].each do |store|
Expand All @@ -18,6 +16,6 @@
) )
end end


use ActionController::RewindableInput use "ActionController::RewindableInput"
use ActionController::ParamsParser use "ActionController::ParamsParser"
use Rack::MethodOverride use "Rack::MethodOverride"
1 change: 1 addition & 0 deletions railties/lib/initializer.rb
Expand Up @@ -408,6 +408,7 @@ def initialize_database
if configuration.frameworks.include?(:active_record) if configuration.frameworks.include?(:active_record)
ActiveRecord::Base.configurations = configuration.database_configuration ActiveRecord::Base.configurations = configuration.database_configuration
ActiveRecord::Base.establish_connection ActiveRecord::Base.establish_connection
configuration.middleware.use ActiveRecord::QueryCache
end end
end end


Expand Down

0 comments on commit 73cc5f2

Please sign in to comment.