diff options
author | Jamis Buck <jamis@37signals.com> | 2005-08-24 16:45:46 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-08-24 16:45:46 +0000 |
commit | 7d65f7cd3dbcf9a3986f0f05b692e83de6515390 (patch) | |
tree | a254f11749ba178e6fa8b34e26713ac207959935 /activerecord/lib | |
parent | 943fde0a55594bb9e75783974e37eba9584ac79b (diff) | |
download | rails-7d65f7cd3dbcf9a3986f0f05b692e83de6515390.tar.gz rails-7d65f7cd3dbcf9a3986f0f05b692e83de6515390.tar.bz2 rails-7d65f7cd3dbcf9a3986f0f05b692e83de6515390.zip |
Revert [2040], caused assignment of belongs_to associations to fail in some cases
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2048 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index d0db4469e2..ffb0d5679b 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -445,12 +445,10 @@ module ActiveRecord module_eval do before_save <<-EOF association = instance_variable_get("@#{association_name}") - if not association.nil? - if association.new_record? - association.save(true) - association.send(:construct_sql) - end + if not association.nil? and association.new_record? + association.save(true) self["#{association_class_primary_key_name}"] = association.id + association.send(:construct_sql) end EOF end |