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
-
#condition?(name) ⇒ Boolean
:nodoc:.
-
#named_scope_options(name) ⇒ Object
:nodoc:.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (private)
22 23 24 25 26 27 28 29 30 |
# File 'lib/searchlogic/named_scopes/or_conditions.rb', line 22 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:
9 10 11 |
# File 'lib/searchlogic/named_scopes/or_conditions.rb', line 9 def condition?(name) # :nodoc: super || or_condition?(name) end |
#named_scope_options(name) ⇒ Object
:nodoc:
13 14 15 |
# File 'lib/searchlogic/named_scopes/or_conditions.rb', line 13 def (name) # :nodoc: super || super(or_conditions(name).try(:join, "_or_")) end |