diff options
author | Chris Holmes <tochrisholmes@gmail.com> | 2016-12-28 19:15:49 +0000 |
---|---|---|
committer | Chris Holmes <tochrisholmes@gmail.com> | 2017-01-04 11:56:08 +0000 |
commit | f8ab3ae18fbb5c4a4c9563296d0e7c528e754c42 (patch) | |
tree | 6cf3de11fe91e202811009251f1666b643c7100d /activerecord/test/cases | |
parent | d304aefc91b485176b3d2fdc2f24147c1f78c132 (diff) | |
download | rails-f8ab3ae18fbb5c4a4c9563296d0e7c528e754c42.tar.gz rails-f8ab3ae18fbb5c4a4c9563296d0e7c528e754c42.tar.bz2 rails-f8ab3ae18fbb5c4a4c9563296d0e7c528e754c42.zip |
Raise error when has_many through is defined before through association
https://github.com/rails/rails/issues/26834
This change raises an error if a has_many through association
is defined before the through association.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 47c6480a8e..ac005b7010 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -1231,4 +1231,12 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase ensure TenantMembership.current_member = nil end + + def test_incorrectly_ordered_through_associations + assert_raises(ActiveRecord::HasManyThroughOrderError) do + DeveloperWithIncorrectlyOrderedHasManyThrough.create( + companies: [Company.create] + ) + end + end end |