aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRoman Shterenzon <romanbsd@yahoo.com>2008-12-27 01:10:29 +0000
committerYehuda Katz <wycats@gmail.com>2009-01-01 00:13:10 -0800
commit7276128fb47d5997437eb5452b4e9a82ee54f4a8 (patch)
tree4e5057bcecb2312c636da67209a2b25a6ece9ab9 /activerecord/test
parent27cfeb7cbcc725c36053833ca8e12cc26357a170 (diff)
downloadrails-7276128fb47d5997437eb5452b4e9a82ee54f4a8.tar.gz
rails-7276128fb47d5997437eb5452b4e9a82ee54f4a8.tar.bz2
rails-7276128fb47d5997437eb5452b4e9a82ee54f4a8.zip
Fix HasManyAssociation#create ignoring the :primary_key option [#1633 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 20b9acda44..a5ae5cd8ec 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1115,5 +1115,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert !client_association.respond_to?(:private_method)
assert client_association.respond_to?(:private_method, true)
end
+
+ def test_creating_using_primary_key
+ firm = Firm.find(:first)
+ client = firm.clients_using_primary_key.create!(:name => 'test')
+ assert_equal firm.name, client.firm_name
+ end
end