提交 841c01fa 编写于 作者: P Pratik Naik

Use class_inheritable_accessor for connection_handler

上级 6704d8c9
......@@ -10,8 +10,8 @@ def initialize (config, adapter_method)
##
# :singleton-method:
# The connection handler
cattr_accessor :connection_handler, :instance_writer => false
@@connection_handler = ConnectionAdapters::ConnectionHandler.new
class_inheritable_accessor :connection_handler, :instance_writer => false
self.connection_handler = ConnectionAdapters::ConnectionHandler.new
# Returns the connection currently associated with the class. This can
# also be used to "borrow" the connection to do database work that isn't
......@@ -54,7 +54,7 @@ def self.establish_connection(spec = nil)
raise AdapterNotSpecified unless defined?(Rails.env)
establish_connection(Rails.env)
when ConnectionSpecification
@@connection_handler.establish_connection(name, spec)
self.connection_handler.establish_connection(name, spec)
when Symbol, String
if configuration = configurations[spec.to_s]
establish_connection(configuration)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册