Permalink
Browse files

Changing order of equality because comparing certain objects with fal…

…se 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
  • Loading branch information...
Lucas Carlson authored and technoweenie committed Jul 2, 2008
1 parent 3b3790a commit d20e8dd2207a848e2712c19ad38d6abb6f98ca07
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/callbacks.rb
@@ -262,7 +262,7 @@ def after_validation_on_update() end
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 @@ def destroy_with_callbacks #:nodoc:
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)

0 comments on commit d20e8dd

Please sign in to comment.