Class: ActiveRecord::QueryMethods::OrChain
- Inherits:
-
Object
- Object
- ActiveRecord::QueryMethods::OrChain
- Defined in:
- lib/rearmed/monkey_patches/rails_4.rb
Instance Method Summary collapse
-
#initialize(scope) ⇒ OrChain
constructor
A new instance of OrChain.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(scope) ⇒ OrChain
Returns a new instance of OrChain.
91 92 93 |
# File 'lib/rearmed/monkey_patches/rails_4.rb', line 91 def initialize(scope) @scope = scope end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/rearmed/monkey_patches/rails_4.rb', line 95 def method_missing(method, *args, &block) right_relation = @scope.klass.unscoped do @scope.klass.send(method, *args, &block) end @scope.or(right_relation) end |