diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-28 09:35:43 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-28 09:35:43 -0800 |
commit | ba0b3eee144000b48ec609b75c18d1cdf07a10f3 (patch) | |
tree | 9dc77c8e0abd21f03fa5b6059d2c7a5e5c44a084 /activerecord/test/cases | |
parent | a0c61c81d7b118b61eb7f385af0d3ba71f95ba93 (diff) | |
parent | cba5a3a367f0f9d3be042c0782716fdfd4930f1c (diff) | |
download | rails-ba0b3eee144000b48ec609b75c18d1cdf07a10f3.tar.gz rails-ba0b3eee144000b48ec609b75c18d1cdf07a10f3.tar.bz2 rails-ba0b3eee144000b48ec609b75c18d1cdf07a10f3.zip |
Merge pull request #3768 from janv/master
Test and fix for Issue 3450
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/autosave_association_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 4ad2cdfc7e..4c3f2bda57 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -347,6 +347,17 @@ class TestDefaultAutosaveAssociationOnABelongsToAssociation < ActiveRecord::Test client.save! assert_no_queries { assert_equal apple, client.firm } end + + def test_validation_does_not_validate_stale_association_target + valid_developer = Developer.create!(:name => "Dude", :salary => 50_000) + invalid_developer = Developer.new() + + auditlog = AuditLog.new(:message => "foo") + auditlog.developer = invalid_developer + auditlog.developer_id = valid_developer.id + + assert auditlog.valid? + end end class TestDefaultAutosaveAssociationOnAHasManyAssociation < ActiveRecord::TestCase |