Permalink
Browse files

Ruby 1.9 compat: instance_eval binding to get the record binding inst…

…ead 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
  • Loading branch information...
1 parent ebe3a0d commit 98292128492840376064994c561de95aeb0c3be6 @jeremy jeremy committed Jan 6, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/validations.rb
@@ -348,7 +348,7 @@ def condition_block?(condition)
def evaluate_condition(condition, record)
case condition
when Symbol; record.send(condition)
- when String; eval(condition, record.send(:binding))
+ when String; eval(condition, record.instance_eval { binding })
else
if condition_block?(condition)
condition.call(record)

0 comments on commit 9829212

Please sign in to comment.