Displaying 1 result from an estimated 1 matches for "first_firm".
Did you mean:
first_dir
2008 May 07
1
Assigning to the foreign key on a belongs_to association
...verecord/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(:another_firm), signals37.firm
+ end
+
def test_no_unexpected_aliasing
first_firm = companies(:first_firm) another_firm =
companies(:another_firm)
--~--~---------~--~----~------------~----...