Module: ActiveRecordShards::Model::InstanceMethods

Defined in:
lib/active_record_shards/model.rb

Instance Method Summary collapse

Instance Method Details

#from_replica?Boolean

Returns:

  • (Boolean)
[View source]

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

def from_replica?
  @from_replica
end

#from_shardObject

[View source]

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

def from_shard
  @from_shard
end

#initialize_shard_and_replicaObject

[View source]

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

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