Module: MagicScopes::PresenceScopes

Included in:
BooleanScopesGenerator, FloatScopesGenerator
Defined in:
lib/magic_scopes/scopes_generators/mixins/presence_scopes.rb

Instance Method Summary collapse

Instance Method Details

#with(name) ⇒ Object



3
4
5
# File 'lib/magic_scopes/scopes_generators/mixins/presence_scopes.rb', line 3

def with(name)
  scope name || "with_#{@attr}", -> { where("#{@key} IS NOT NULL") }
end

#without(name) ⇒ Object



7
8
9
# File 'lib/magic_scopes/scopes_generators/mixins/presence_scopes.rb', line 7

def without(name)
  scope name || "without_#{@attr}", -> { where("#{@key} IS NULL") }
end