Module: Searchlogic::NamedScopes::OrConditions

Included in:
ActiveRecord::Base
Defined in:
lib/searchlogic/named_scopes/or_conditions.rb

Overview

Handles dynamically creating named scopes for ‘OR’ conditions. Please see the README for a more detailed explanation.

Defined Under Namespace

Classes: NoConditionSpecifiedError, UnknownConditionError

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



18
19
20
21
22
23
24
25
26
# File 'lib/searchlogic/named_scopes/or_conditions.rb', line 18

def method_missing(name, *args, &block)
  if conditions = or_conditions(name)
    create_or_condition(conditions, args)
    (class << self; self; end).class_eval { alias_method name, conditions.join("_or_") } if !respond_to?(name)
    send(name, *args)
  else
    super
  end
end

Instance Method Details

#condition?(name) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


9
10
11
# File 'lib/searchlogic/named_scopes/or_conditions.rb', line 9

def condition?(name) # :nodoc:
  super || or_condition?(name)
end