Sha256: 647c101c6f0ce2a39c49e4d672150e62324914ef28994e955c42f1cc6dfff797

Contents?: true

Size: 587 Bytes

Versions: 7

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true

module Switchman
  module GuardRail
    module Relation
      def exec_queries(*args)
        if lock_value
          db = Shard.current(connection_class_for_self).database_server
          db.unguard { super }
        else
          super
        end
      end

      %w[update_all delete_all].each do |method|
        class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def #{method}(*args)
            db = Shard.current(connection_class_for_self).database_server
            db.unguard { super }
          end
        RUBY
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
switchman-3.3.0 lib/switchman/guard_rail/relation.rb
switchman-3.2.1 lib/switchman/guard_rail/relation.rb
switchman-3.2.0 lib/switchman/guard_rail/relation.rb
switchman-3.1.3 lib/switchman/guard_rail/relation.rb
switchman-3.1.2 lib/switchman/guard_rail/relation.rb
switchman-3.1.1 lib/switchman/guard_rail/relation.rb
switchman-3.1.0 lib/switchman/guard_rail/relation.rb