diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-16 21:15:34 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-16 21:15:34 -0200 |
commit | 88a296dccc401da143d90cad54b693ff06bf2b58 (patch) | |
tree | 48fffd9e694b6a9ffb5bed2b921e08edf1824f8c /activerecord/test/cases/associations | |
parent | 666a7e34f553cef4c8878362eafc79c7e3f310c3 (diff) | |
parent | b6a2baee830f464344b7cb82caaa528be1db7389 (diff) | |
download | rails-88a296dccc401da143d90cad54b693ff06bf2b58.tar.gz rails-88a296dccc401da143d90cad54b693ff06bf2b58.tar.bz2 rails-88a296dccc401da143d90cad54b693ff06bf2b58.zip |
Merge pull request #7983 from georgebrock/bug7950-squashed
Backport 4bc2ae0 to fix #7950
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/calculations.rb
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 7 |
1 files changed, 7 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 ed4475770b..c311bf70d2 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1225,6 +1225,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert companies(:first_firm).clients.include?(Client.find(2)) end + def test_included_in_collection_for_new_records + client = Client.create(:name => 'Persisted') + assert_nil client.client_of + assert !Firm.new.clients_of_firm.include?(client), + 'includes a client that does not belong to any firm' + end + def test_adding_array_and_collection assert_nothing_raised { Firm.find(:first).clients + Firm.find(:all).last.clients } end |