Module: ActiveRecordShards::Model::InstanceMethods

Defined in:
lib/active_record_shards/model.rb

Instance Method Summary collapse

Instance Method Details

#from_replica?Boolean

Returns:

  • (Boolean)


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

def from_replica?
  @from_replica
end

#from_shardObject



59
60
61
# File 'lib/active_record_shards/model.rb', line 59

def from_shard
  @from_shard
end

#initialize_shard_and_replicaObject



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

def initialize_shard_and_replica
  @from_replica = !!self.class.current_shard_selection.options[:replica]
  @from_shard = self.class.current_shard_selection.options[:shard]
end