diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-02-29 11:17:25 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-02-29 11:20:43 -0700 |
commit | 67aa8f194331d7b19b47eb80b71bff027df8684f (patch) | |
tree | 773065bc1f82ce64f51e5631d20bcd5d3333bd59 /activerecord/test/models | |
parent | 1d3502c32e5553d3e9e73cb7d38db0c1d6427aaf (diff) | |
parent | 524238139025ccddfa886bcfd7a1a6434954e305 (diff) | |
download | rails-67aa8f194331d7b19b47eb80b71bff027df8684f.tar.gz rails-67aa8f194331d7b19b47eb80b71bff027df8684f.tar.bz2 rails-67aa8f194331d7b19b47eb80b71bff027df8684f.zip |
Merge pull request #18766 from yasyf/issue_17864
Honour joining model order in `has_many :through` associations when
eager loading
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/tag.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/models/tag.rb b/activerecord/test/models/tag.rb index 80d4725f7e..b48b9a2155 100644 --- a/activerecord/test/models/tag.rb +++ b/activerecord/test/models/tag.rb @@ -5,3 +5,9 @@ class Tag < ActiveRecord::Base has_many :tagged_posts, :through => :taggings, :source => 'taggable', :source_type => 'Post' end + +class OrderedTag < Tag + self.table_name = "tags" + + has_many :taggings, -> { order('taggings.id DESC') }, foreign_key: 'tag_id' +end |