Module: ActiveRecord::Associations::AssociationCollection::Replica

Defined in:
lib/replica/association_collection.rb

Defined Under Namespace

Classes: Proxy

Instance Method Summary collapse

Instance Method Details

#with_masterObject



9
10
11
# File 'lib/replica/association_collection.rb', line 9

def with_master
  with_replica(nil)
end

#with_replica(replica_name) ⇒ Object



21
22
23
# File 'lib/replica/association_collection.rb', line 21

def with_replica(replica_name)
  Proxy.new(self, replica_name)
end

#with_slaveObject



5
6
7
# File 'lib/replica/association_collection.rb', line 5

def with_slave
  with_replica(:slave)
end

#with_slave_if(condition) ⇒ Object



13
14
15
# File 'lib/replica/association_collection.rb', line 13

def with_slave_if(condition)
  condition ? with_slave : with_master
end

#with_slave_unless(condition) ⇒ Object



17
18
19
# File 'lib/replica/association_collection.rb', line 17

def with_slave_unless(condition)
  with_slave_if(!condition)
end