Sha256: 03699644c50b00f8ec8155799cb19d733450df43f197b00e780879be13e101bc

Contents?: true

Size: 413 Bytes

Versions: 2

Compression:

Stored size: 413 Bytes

Contents

require 'disallow/exceptions'

module Disallow
  module Scopes
    def disallow_default_scope!(options = {})
      if default_scopes.present?
        raise Disallow::DefaultScopeError.new(name)
      end

      @disallow_default_scope = true
    end

    def default_scope(*args)
      if @disallow_default_scope
        raise Disallow::DefaultScopeError.new(name)
      end

      super(*args)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
disallow-0.1.1 lib/disallow/scopes.rb
disallow-0.1.0 lib/disallow/scopes.rb