Module: ActiveRecord::Turntable::ActiveRecordExt::ActsAsArchiveExt::ClassMethods

Defined in:
lib/active_record/turntable/active_record_ext/acts_as_archive_extension.rb

Instance Method Summary collapse

Instance Method Details

#move(config, where, merge_options = {}) ⇒ Object

Note:

use the same shard which ‘from` shard using



12
13
14
15
16
17
18
19
20
21
# File 'lib/active_record/turntable/active_record_ext/acts_as_archive_extension.rb', line 12

def move(config, where, merge_options = {})
  if [config[:to], config[:from]].all? { |k| k.try(:turntable_enabled?) }
    current_shard = config[:from].connection.current_shard.name.to_sym
    config[:to].connection.with_shard(current_shard) {
      super
    }
  else
    super
  end
end