aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorChris Holmes <tochrisholmes@gmail.com>2016-12-28 19:15:49 +0000
committerChris Holmes <tochrisholmes@gmail.com>2017-01-04 11:56:08 +0000
commitf8ab3ae18fbb5c4a4c9563296d0e7c528e754c42 (patch)
tree6cf3de11fe91e202811009251f1666b643c7100d /activerecord/test/models
parentd304aefc91b485176b3d2fdc2f24147c1f78c132 (diff)
downloadrails-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/models')
-rw-r--r--activerecord/test/models/developer.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb
index ea4f719517..654830ba11 100644
--- a/activerecord/test/models/developer.rb
+++ b/activerecord/test/models/developer.rb
@@ -260,3 +260,9 @@ class CachedDeveloper < ActiveRecord::Base
self.table_name = "developers"
self.cache_timestamp_format = :number
end
+
+class DeveloperWithIncorrectlyOrderedHasManyThrough < ActiveRecord::Base
+ self.table_name = "developers"
+ has_many :companies, through: :contracts
+ has_many :contracts, foreign_key: :developer_id
+end