aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-11 00:24:19 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-11 00:24:19 +0000
commit79365a0184c58def99aff4c4b213048a25179f6a (patch)
tree2a33951d6e17d9a2869da4aa6eb728a71092ff5a /activerecord/test/associations_test.rb
parentbcb81167960293596d44587ea237ace4d505b960 (diff)
downloadrails-79365a0184c58def99aff4c4b213048a25179f6a.tar.gz
rails-79365a0184c58def99aff4c4b213048a25179f6a.tar.bz2
rails-79365a0184c58def99aff4c4b213048a25179f6a.zip
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
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb8
1 files changed, 7 insertions, 1 deletions
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")