From ae74e8e9feba99b84f5e431239dc6a2039ad5793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Wed, 16 Aug 2006 16:05:48 +0000 Subject: 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 --- activerecord/test/associations_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test') 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 -- cgit v1.2.3