Displaying 1 result from an estimated 1 matches for "belongstoassociationstest".
2008 May 07
1
Assigning to the foreign key on a belongs_to association
..._associations_test.rb b/activerecord/test/cases/associations/
belongs_to_associations_test.rb
index b8ec911..c130db2 100644--- a/activerecord/test/cases/
associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/
belongs_to_associations_test.rb
@@ -45,6 +45,13 @@ class BelongsToAssociationsTest <
ActiveRecord::TestCase
assert_equal apple.id, citibank.firm_id
end
+ def test_foreign_key_assignment
+ signals37 = accounts(:signals37)
+ assert_equal companies(:first_firm), signals37.firm
+ signals37.firm_id = companies(:another_firm).id
+ assert_equal companies(:anothe...