diff options
author | Thiago Pradi <thiago.pradi@gmail.com> | 2012-09-02 18:56:45 -0300 |
---|---|---|
committer | Thiago Pradi <thiago.pradi@gmail.com> | 2012-09-09 16:23:52 -0300 |
commit | 652107e2e137cf18cf517d96ee9063660e86d686 (patch) | |
tree | 097701bdc014fd6cb5d3af1c59ef668c17db8fb2 /activerecord/test/cases/associations/belongs_to_associations_test.rb | |
parent | cabab374bfc6c1bd1d783ecc3c674047f17523c6 (diff) | |
download | rails-652107e2e137cf18cf517d96ee9063660e86d686.tar.gz rails-652107e2e137cf18cf517d96ee9063660e86d686.tar.bz2 rails-652107e2e137cf18cf517d96ee9063660e86d686.zip |
ConnectionAdapters::Column.type_cast_code should always convert values to integer calling #to_i
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 1160d236c9..e7d1893ff3 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -63,6 +63,12 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_equal apple.id, citibank.firm_id end + def test_id_assignment + apple = Firm.create("name" => "Apple") + citibank = Account.create("credit_limit" => 10) + assert_raise(NoMethodError) { citibank.firm_id = apple } + end + def test_natural_assignment_with_primary_key apple = Firm.create("name" => "Apple") citibank = Client.create("name" => "Primary key client") |