From cba5a3a367f0f9d3be042c0782716fdfd4930f1c Mon Sep 17 00:00:00 2001 From: Jan Varwig Date: Sun, 27 Nov 2011 11:47:45 +0100 Subject: Test case and fix for rails/rails#3450 Asssigning a parent id to a belongs_to association actually updates the object that is validated when the association has :validates => true --- activerecord/lib/active_record/autosave_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/autosave_association.rb') diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 056170d82a..d709a77fb0 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -264,7 +264,7 @@ module ActiveRecord # turned on for the association. def validate_single_association(reflection) association = association_instance_get(reflection.name) - record = association && association.target + record = association && association.reader association_valid?(reflection, record) if record end -- cgit v1.2.3