Sha256: 9c2ccf05d15cc0694ce8f7acd829508008554e53c8c12534afba307d266d9384

Contents?: true

Size: 574 Bytes

Versions: 11

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

module Switchman
  module ActiveRecord
    module Persistence
      # touch reads the id attribute directly, so it's not relative to the current shard
      def touch(*, **)
        shard.activate(self.class.connection_classes) { super }
      end

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

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

        super
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
switchman-3.0.16 lib/switchman/active_record/persistence.rb
switchman-3.0.15 lib/switchman/active_record/persistence.rb
switchman-3.0.14 lib/switchman/active_record/persistence.rb
switchman-3.0.13 lib/switchman/active_record/persistence.rb
switchman-3.0.12 lib/switchman/active_record/persistence.rb
switchman-3.0.11 lib/switchman/active_record/persistence.rb
switchman-3.0.10 lib/switchman/active_record/persistence.rb
switchman-3.0.9 lib/switchman/active_record/persistence.rb
switchman-3.0.8 lib/switchman/active_record/persistence.rb
switchman-3.0.7 lib/switchman/active_record/persistence.rb
switchman-3.0.6 lib/switchman/active_record/persistence.rb