aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2006-08-16 16:05:48 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2006-08-16 16:05:48 +0000
commitae74e8e9feba99b84f5e431239dc6a2039ad5793 (patch)
treefc9ea426fe47e5669bcdef14adb807e371f7e00e /activerecord/test
parent14101c7b40c2e04303cb497eb60996add2de645f (diff)
downloadrails-ae74e8e9feba99b84f5e431239dc6a2039ad5793.tar.gz
rails-ae74e8e9feba99b84f5e431239dc6a2039ad5793.tar.bz2
rails-ae74e8e9feba99b84f5e431239dc6a2039ad5793.zip
Fixed a bug which would cause .save to fail after trying to access a empty has_one association on a unsaved record.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4773 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/associations_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index f99322d976..cb704ffd2e 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -313,6 +313,16 @@ class HasOneAssociationsTest < Test::Unit::TestCase
firm.account = Account.find(:first).clone
assert_queries(2) { firm.save! }
end
+
+ def test_save_still_works_after_accessing_nil_has_one
+ jp = Company.new :name => 'Jaded Pixel'
+ jp.dummy_account.nil?
+
+ assert_nothing_raised do
+ jp.save!
+ end
+ end
+
end