Module: ConnectionManager::Using::ClassMethods

Defined in:
lib/connection_manager/using.rb

Instance Method Summary collapse

Instance Method Details

#using(connection_class_name) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/connection_manager/using.rb', line 5

def using(connection_class_name)
  d = fetch_duplicate_class(connection_class_name)
  r = ActiveRecord::Relation.new(d, d.arel_table)
  r = r.readonly if d.connection.readonly?
  r = r.from(d.quoted_table_name) unless (ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0)
  r
end