diff options
author | Lucas Carlson <lucas@rufy.com> | 2008-07-02 16:54:31 -0700 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2008-07-02 21:24:48 -0700 |
commit | d20e8dd2207a848e2712c19ad38d6abb6f98ca07 (patch) | |
tree | ca36f0de8c32bbacaafc5d410bf577df08172afa /activerecord | |
parent | 3b3790a4351ba7c9d2711089c21f24fcedc11fc0 (diff) | |
download | rails-d20e8dd2207a848e2712c19ad38d6abb6f98ca07.tar.gz rails-d20e8dd2207a848e2712c19ad38d6abb6f98ca07.tar.bz2 rails-d20e8dd2207a848e2712c19ad38d6abb6f98ca07.zip |
Changing order of equality because comparing certain objects with false raises an error.
>> require 'md5'
=> true
>> MD5.new("Asds") == false
TypeError: can't convert false into String
from (irb):2:in `=='
from (irb):2
>> false == MD5.new("Asds")
=> false
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/callbacks.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 4edc209c65..1e385fb128 100755 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -262,7 +262,7 @@ module ActiveRecord def valid_with_callbacks? #:nodoc: return false if callback(:before_validation) == false if new_record? then result = callback(:before_validation_on_create) else result = callback(:before_validation_on_update) end - return false if result == false + return false if false == result result = valid_without_callbacks? @@ -293,7 +293,7 @@ module ActiveRecord private def callback(method) - result = run_callbacks(method) { |result, object| result == false } + result = run_callbacks(method) { |result, object| false == result } if result != false && respond_to_without_attributes?(method) result = send(method) |