Module: Switchman::ActiveRecord::Persistence

Defined in:
lib/switchman/active_record/persistence.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



15
16
17
18
19
20
# File 'lib/switchman/active_record/persistence.rb', line 15

def delete
  db = shard.database_server
  return db.unguard { super } unless ::GuardRail.environment == db.guard_rail_environment

  super
end

#touchObject

touch reads the id attribute directly, so it’s not relative to the current shard



7
8
9
# File 'lib/switchman/active_record/persistence.rb', line 7

def touch(*, **)
  shard.activate(self.class.connection_classes) { super }
end

#update_columnsObject



11
12
13
# File 'lib/switchman/active_record/persistence.rb', line 11

def update_columns(*)
  shard.activate(self.class.connection_classes) { super }
end