diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-10-13 16:45:30 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-10-13 16:45:30 -0300 |
commit | 95cb54a29ee014253665abc4e9068fffc578128d (patch) | |
tree | df17854bf076412d7be296ee677da531d92eba05 /activerecord/CHANGELOG.md | |
parent | 0b2884a8ae6891f6507303b487dc3deff4fb0852 (diff) | |
parent | bc293ff690e5478b99a55594f9fa8fe0e709941b (diff) | |
download | rails-95cb54a29ee014253665abc4e9068fffc578128d.tar.gz rails-95cb54a29ee014253665abc4e9068fffc578128d.tar.bz2 rails-95cb54a29ee014253665abc4e9068fffc578128d.zip |
Merge pull request #12508 from jetthoughts/12415_generate_subqueries_for_relation_from_binding_params
Generate subquery for Relation passed as array condition for where
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 658645275d..e122b0181e 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,20 @@ +* Generate subquery for `Relation` if it passed as array condition for `where` method + + Example: + # Before + Blog.where('id in (?)', Blog.where(id: 1)) + # => SELECT "blogs".* FROM "blogs" WHERE "blogs"."id" = 1 + # => SELECT "blogs".* FROM "blogs" WHERE (id IN (1)) + + # After + Blog.where('id in (?)', Blog.where(id: 1).select(:id)) + # => SELECT "blogs".* FROM "blogs" + # WHERE "blogs"."id" IN (SELECT "blogs"."id" FROM "blogs" WHERE "blogs"."id" = 1) + + Fixes: #12415 + + *Paul Nikitochkin* + * For missed association exception message which is raised in `ActiveRecord::Associations::Preloader` class added owner record class name in order to simplify to find problem code. |