mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
s/specification_name/connection_specification_name
This commit is contained in:
parent
598e7c9e20
commit
22a127c57b
4 changed files with 14 additions and 14 deletions
|
@ -51,7 +51,7 @@ module ActiveRecord
|
|||
resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new configurations
|
||||
# TODO: uses name on establish_connection, for backwards compatibility
|
||||
spec = resolver.spec(spec, self == Base ? "primary" : name)
|
||||
self.specification_name = spec.name
|
||||
self.connection_specification_name = spec.name
|
||||
|
||||
unless respond_to?(spec.adapter_method)
|
||||
raise AdapterNotFound, "database configuration specifies nonexistent #{spec.config[:adapter]} adapter"
|
||||
|
@ -91,15 +91,15 @@ module ActiveRecord
|
|||
retrieve_connection
|
||||
end
|
||||
|
||||
attr_writer :specification_name
|
||||
attr_writer :connection_specification_name
|
||||
|
||||
# Return the specification id from this class otherwise look it up
|
||||
# in the parent.
|
||||
def specification_name
|
||||
unless defined?(@specification_name)
|
||||
@specification_name = self == Base ? "primary" : superclass.specification_name
|
||||
def connection_specification_name
|
||||
unless defined?(@connection_specification_name)
|
||||
@connection_specification_name = self == Base ? "primary" : superclass.connection_specification_name
|
||||
end
|
||||
@specification_name
|
||||
@connection_specification_name
|
||||
end
|
||||
|
||||
def connection_id
|
||||
|
@ -121,19 +121,19 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def connection_pool
|
||||
connection_handler.retrieve_connection_pool(specification_name) or raise ConnectionNotEstablished
|
||||
connection_handler.retrieve_connection_pool(connection_specification_name) or raise ConnectionNotEstablished
|
||||
end
|
||||
|
||||
def retrieve_connection
|
||||
connection_handler.retrieve_connection(specification_name)
|
||||
connection_handler.retrieve_connection(connection_specification_name)
|
||||
end
|
||||
|
||||
# Returns +true+ if Active Record is connected.
|
||||
def connected?
|
||||
connection_handler.connected?(specification_name)
|
||||
connection_handler.connected?(connection_specification_name)
|
||||
end
|
||||
|
||||
def remove_connection(name = specification_name)
|
||||
def remove_connection(name = connection_specification_name)
|
||||
connection_handler.remove_connection(name)
|
||||
end
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ module ActiveRecord
|
|||
# Returns the Arel engine.
|
||||
def arel_engine # :nodoc:
|
||||
@arel_engine ||=
|
||||
if Base == self || connection_handler.retrieve_connection_pool(specification_name)
|
||||
if Base == self || connection_handler.retrieve_connection_pool(connection_specification_name)
|
||||
self
|
||||
else
|
||||
superclass.arel_engine
|
||||
|
|
|
@ -117,7 +117,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def create_all
|
||||
old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.specification_name)
|
||||
old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.connection_specification_name)
|
||||
each_local_configuration { |configuration| create configuration }
|
||||
if old_pool
|
||||
ActiveRecord::Base.connection_handler.establish_connection(old_pool.spec)
|
||||
|
|
|
@ -25,10 +25,10 @@ class MultipleDbTest < ActiveRecord::TestCase
|
|||
end
|
||||
|
||||
def test_swapping_the_connection
|
||||
old_spec_name, Course.specification_name = Course.specification_name, "primary"
|
||||
old_spec_name, Course.connection_specification_name = Course.connection_specification_name, "primary"
|
||||
assert_equal(Entrant.connection, Course.connection)
|
||||
ensure
|
||||
Course.specification_name = old_spec_name
|
||||
Course.connection_specification_name = old_spec_name
|
||||
end
|
||||
|
||||
def test_find
|
||||
|
|
Loading…
Reference in a new issue