提交 73cc5f27 编写于 作者: J Joshua Peek

Setup ActiveRecord QueryCache middleware in the initializer

上级 82334a74
...@@ -4,8 +4,6 @@ ...@@ -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|
...@@ -18,6 +16,6 @@ ...@@ -18,6 +16,6 @@
) )
end end
use ActionController::RewindableInput use "ActionController::RewindableInput"
use ActionController::ParamsParser use "ActionController::ParamsParser"
use Rack::MethodOverride use "Rack::MethodOverride"
...@@ -408,6 +408,7 @@ def initialize_database ...@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册