From f8ab3ae18fbb5c4a4c9563296d0e7c528e754c42 Mon Sep 17 00:00:00 2001 From: Chris Holmes Date: Wed, 28 Dec 2016 19:15:49 +0000 Subject: 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. --- activerecord/test/models/developer.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/test/models') 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 -- cgit v1.2.3