1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ruby 1.9 compat: instance_eval binding to get the record binding instead of accidentally getting current Kernel#binding. Closes #10716 [Dirkjan Bussink]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8575 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2008-01-06 20:27:56 +00:00
parent ebe3a0d532
commit 9829212849

View file

@ -348,7 +348,7 @@ module ActiveRecord
def evaluate_condition(condition, record) def evaluate_condition(condition, record)
case condition case condition
when Symbol; record.send(condition) when Symbol; record.send(condition)
when String; eval(condition, record.send(:binding)) when String; eval(condition, record.instance_eval { binding })
else else
if condition_block?(condition) if condition_block?(condition)
condition.call(record) condition.call(record)