Method: MongoMapper::Plugins::Persistence::ClassMethods#slave_connection

Defined in:
lib/mongo_mapper/plugins/persistence.rb

#slave_connectionObject



18
19
20
21
22
23
24
25
# File 'lib/mongo_mapper/plugins/persistence.rb', line 18

def slave_connection
  not_supported_by_embedded
  raise "Slave connections have not been configured" if MongoMapper.slave_connections.empty?
  @slave_idx ||= 0
  conn = MongoMapper.slave_connections[@slave_idx]
  increment_slave_idx
  conn
end