class ActiveRecord::QueryMethods::OrChain
OrChain
objects act as placeholder for queries in which or does not have any parameter. In this case, or must be chained with any other relation method to return a new relation. It is intended to allow .or.where() and .or.named_scope.
Public Class Methods
new(scope)
click to toggle source
# File lib/by2/ext/active_record.rb, line 19 def initialize(scope) @scope = scope end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
# File lib/by2/ext/active_record.rb, line 23 def method_missing(method, *args, &block) right_relation = @scope.klass.unscoped do @scope.klass.send(method, *args, &block) end @scope.or(right_relation) end