static public Method

Base.connection=(spec)

Set the connection for the class.

Source Code

# File active_record/connection_adapters/abstract/connection_specification.rb, line 286
def self.connection=(spec) #:nodoc:
  if spec.kind_of?(ActiveRecord::ConnectionAdapters::AbstractAdapter)
    active_connections[name] = spec
  elsif spec.kind_of?(ConnectionSpecification)
    config = spec.config.reverse_merge(:allow_concurrency => @@allow_concurrency)
    self.connection = self.send(spec.adapter_method, config)
  elsif spec.nil?
    raise ConnectionNotEstablished
  else
    establish_connection spec
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.