Fix evals missing context
This commit is contained in:
parent
86dda361e2
commit
6d29f9789e
@ -10,7 +10,7 @@ module QueryMethods
|
||||
attr_accessor :"#{query_method}_values"
|
||||
|
||||
next if [:where, :having].include?(query_method)
|
||||
class_eval <<-CEVAL
|
||||
class_eval <<-CEVAL, __FILE__
|
||||
def #{query_method}(*args, &block)
|
||||
new_relation = clone
|
||||
new_relation.send(:apply_modules, Module.new(&block)) if block_given?
|
||||
@ -22,7 +22,7 @@ def #{query_method}(*args, &block)
|
||||
end
|
||||
|
||||
[:where, :having].each do |query_method|
|
||||
class_eval <<-CEVAL
|
||||
class_eval <<-CEVAL, __FILE__
|
||||
def #{query_method}(*args, &block)
|
||||
new_relation = clone
|
||||
new_relation.send(:apply_modules, Module.new(&block)) if block_given?
|
||||
@ -36,7 +36,7 @@ def #{query_method}(*args, &block)
|
||||
ActiveRecord::Relation::SINGLE_VALUE_METHODS.each do |query_method|
|
||||
attr_accessor :"#{query_method}_value"
|
||||
|
||||
class_eval <<-CEVAL
|
||||
class_eval <<-CEVAL, __FILE__
|
||||
def #{query_method}(value = true, &block)
|
||||
new_relation = clone
|
||||
new_relation.send(:apply_modules, Module.new(&block)) if block_given?
|
||||
|
Loading…
Reference in New Issue
Block a user