diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2019-02-13 12:25:43 +0200 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2019-02-20 13:48:51 +0200 |
commit | bd4eff2f99ffa5868574c497bc63f320cbda3083 (patch) | |
tree | b21d4bdea255230b35ebc142472aaf3120dfed33 /activerecord/test/models | |
parent | 4cb1438b57067d637c79d49d0662c43b5b4e64c2 (diff) | |
download | rails-bd4eff2f99ffa5868574c497bc63f320cbda3083.tar.gz rails-bd4eff2f99ffa5868574c497bc63f320cbda3083.tar.bz2 rails-bd4eff2f99ffa5868574c497bc63f320cbda3083.zip |
Fix reset of the source association when through association is loaded
The special case happens when through association has a custom scope
that is applied to the source association when loading.
In this case, the soucre association would need to be reset after
main association is loaded. See tests.
The special case exists when a through association has
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/category.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/models/category.rb b/activerecord/test/models/category.rb index 2ccc00bed9..8c86879dc6 100644 --- a/activerecord/test/models/category.rb +++ b/activerecord/test/models/category.rb @@ -26,6 +26,7 @@ class Category < ActiveRecord::Base has_many :categorizations has_many :special_categorizations has_many :post_comments, through: :posts, source: :comments + has_many :ordered_post_comments, -> { order(id: :desc) }, through: :posts, source: :comments has_many :authors, through: :categorizations has_many :authors_with_select, -> { select "authors.*, categorizations.post_id" }, through: :categorizations, source: :author |