Sha256: eac413cd32b1eab3e4f5d69e09b40202c7fa8461b86617165f5c8b2be2a38462

Contents?: true

Size: 767 Bytes

Versions: 22

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

module Switchman
  module GuardRail
    module Relation
      def exec_queries(*args)
        if self.lock_value
          db = Shard.current(shard_category).database_server
          if ::GuardRail.environment != db.guard_rail_environment
            return db.unguard { super }
          end
        end
        super
      end

      %w{update_all delete_all}.each do |method|
        class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def #{method}(*args)
            db = Shard.current(shard_category).database_server
            if ::GuardRail.environment != db.guard_rail_environment
              db.unguard { super }
            else
              super
            end
          end
        RUBY
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
switchman-2.2.3 lib/switchman/guard_rail/relation.rb
switchman-2.2.2 lib/switchman/guard_rail/relation.rb
switchman-2.2.1 lib/switchman/guard_rail/relation.rb
switchman-2.2.0 lib/switchman/guard_rail/relation.rb
switchman-2.1.6 lib/switchman/guard_rail/relation.rb
switchman-2.1.5 lib/switchman/guard_rail/relation.rb
switchman-2.1.4 lib/switchman/guard_rail/relation.rb
switchman-2.1.3 lib/switchman/guard_rail/relation.rb
switchman-2.1.2 lib/switchman/guard_rail/relation.rb
switchman-2.1.1 lib/switchman/guard_rail/relation.rb
switchman-2.1.0 lib/switchman/guard_rail/relation.rb
switchman-2.0.13 lib/switchman/guard_rail/relation.rb
switchman-2.0.12 lib/switchman/guard_rail/relation.rb
switchman-2.0.11 lib/switchman/guard_rail/relation.rb
switchman-2.0.10 lib/switchman/guard_rail/relation.rb
switchman-2.0.9 lib/switchman/guard_rail/relation.rb
switchman-2.0.8 lib/switchman/guard_rail/relation.rb
switchman-2.0.7 lib/switchman/guard_rail/relation.rb
switchman-2.0.6 lib/switchman/guard_rail/relation.rb
switchman-2.0.5 lib/switchman/guard_rail/relation.rb