aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/test/associations_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index 668bcb54a8..6ed550a730 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -584,6 +584,14 @@ class BelongsToAssociationsTest < Test::Unit::TestCase
assert_equal @first_firm, c.firm_with_basic_id
end
+ def test_forgetting_the_load_when_foreign_key_enters_late
+ c = Client.new
+ assert_nil c.firm_with_basic_id
+
+ c.firm_id = 1
+ assert_equal @first_firm, c.firm_with_basic_id
+ end
+
def test_field_name_same_as_foreign_key
computer = Computer.find 1
assert_not_nil computer.developer, ":foreign key == attribute didn't lock up"