From 79365a0184c58def99aff4c4b213048a25179f6a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 11 Jan 2005 00:24:19 +0000 Subject: Fixed that foreign keys named the same as the association would cause stack overflow #437 [Eric Anderson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@382 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/test/associations_test.rb') diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 844f075f34..26640d0048 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -5,6 +5,7 @@ require 'fixtures/project' require 'fixtures/company' require 'fixtures/topic' require 'fixtures/reply' +require 'fixtures/computer' # Can't declare new classes in test case methods, so tests before that bad_collection_keys = false @@ -18,7 +19,7 @@ raise "ActiveRecord should have barked on bad collection keys" unless bad_collec class AssociationsTest < Test::Unit::TestCase def setup - create_fixtures "accounts", "companies", "developers", "projects", "developers_projects" + create_fixtures "accounts", "companies", "developers", "projects", "developers_projects", "computers" @signals37 = Firm.find(1) end @@ -418,6 +419,11 @@ class BelongsToAssociationsTest < Test::Unit::TestCase assert_equal 0, Topic.find(debate.id).send(:read_attribute, "replies_count"), "First reply deleted" 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" + end + def xtest_counter_cache apple = Firm.create("name" => "Apple") final_cut = apple.clients.create("name" => "Final Cut") -- cgit v1.2.3