From ac715b2bcbc1dee525339edec86362261e017bbe Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 2 Nov 2006 09:45:17 +0000 Subject: has_one :dependent => :nullify ignores nil associates. Closes #6528. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5401 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f40e44e804..8a1b6ca933 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1060,7 +1060,7 @@ module ActiveRecord when :delete module_eval "before_destroy '#{reflection.class_name}.delete(#{reflection.name}.id) unless #{reflection.name}.nil?'" when :nullify - module_eval "before_destroy '#{reflection.name}.update_attribute(\"#{reflection.primary_key_name}\", nil)'" + module_eval "before_destroy '#{reflection.name}.update_attribute(\"#{reflection.primary_key_name}\", nil) unless #{reflection.name}.nil?'" when nil, false # pass else -- cgit v1.2.3