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
This commit is contained in:
Lucas Carlson
2008-07-02 16:54:31 -07:00
committed by rick
parent 3b3790a435
commit d20e8dd220

View File

@@ -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)