Module: ActiveRecordShards::Model::InstanceMethods

Defined in:
lib/active_record_shards/model.rb

Instance Method Summary collapse

Instance Method Details

#from_shardObject



55
56
57
# File 'lib/active_record_shards/model.rb', line 55

def from_shard
  @from_shard
end

#from_slave?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/active_record_shards/model.rb', line 51

def from_slave?
  @from_slave
end

#initialize_shard_and_slaveObject



46
47
48
49
# File 'lib/active_record_shards/model.rb', line 46

def initialize_shard_and_slave
  @from_slave = !!self.class.current_shard_selection.options[:slave]
  @from_shard = self.class.current_shard_selection.options[:shard]
end