aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_one_through_association.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-11-28 16:55:48 +0100
committerJosé Valim <jose.valim@gmail.com>2010-11-28 16:55:53 +0100
commite444439fe28f873c783a4b99b1c9f29a7405dd0d (patch)
tree75ac578b9a756cabf8af1d08e969d3623f440610 /activerecord/lib/active_record/associations/has_one_through_association.rb
parent31906eecdf7bffc2203379c5d40f1bb77fb35858 (diff)
downloadrails-e444439fe28f873c783a4b99b1c9f29a7405dd0d.tar.gz
rails-e444439fe28f873c783a4b99b1c9f29a7405dd0d.tar.bz2
rails-e444439fe28f873c783a4b99b1c9f29a7405dd0d.zip
Partialy revert f1c13b0dd7b22b5f6289ca1a09f1d7a8c7c8584b
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_one_through_association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_through_association.rb b/activerecord/lib/active_record/associations/has_one_through_association.rb
index 6e98f7dffb..7f28abf464 100644
--- a/activerecord/lib/active_record/associations/has_one_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_one_through_association.rb
@@ -21,7 +21,7 @@ module ActiveRecord
if current_object
new_value ? current_object.update_attributes(construct_join_attributes(new_value)) : current_object.destroy
elsif new_value
- unless @owner.persisted?
+ if @owner.new_record?
self.target = new_value
through_association = @owner.send(:association_instance_get, @reflection.through_reflection.name)
through_association.build(construct_join_attributes(new_value))