aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-01-16 21:14:34 +0000
committerJon Leighton <j@jonathanleighton.com>2012-01-16 21:32:12 +0000
commita2dab46cae35a06fd5c5500037177492a047c252 (patch)
treeaf4be28070368eccdc1151df59384c9ca7aee1bf /activerecord/CHANGELOG.md
parent46ea4442f3abc33d15e03487bae1c80346eab49a (diff)
downloadrails-a2dab46cae35a06fd5c5500037177492a047c252.tar.gz
rails-a2dab46cae35a06fd5c5500037177492a047c252.tar.bz2
rails-a2dab46cae35a06fd5c5500037177492a047c252.zip
Deprecate inferred JOINs with includes + SQL snippets.
See the CHANGELOG for details. Fixes #950.
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index bba6447bf9..7173f44df6 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,5 +1,35 @@
## Rails 4.0.0 (unreleased) ##
+* In previous releases, the following would generate a single query with
+ an `OUTER JOIN comments`, rather than two separate queries:
+
+ Post.includes(:comments)
+ .where("comments.name = 'foo'")
+
+ This behaviour relies on matching SQL string, which is an inherently
+ flawed idea unless we write an SQL parser, which we do not wish to
+ do.
+
+ Therefore, you must explicitly state which tables you reference,
+ when using SQL snippets:
+
+ Post.includes(:comments)
+ .where("comments.name = 'foo'")
+ .references(:comments)
+
+ Note that you do not need to explicitly specify references in the
+ following cases, as they can be automatically inferred:
+
+ Post.where(comments: { name: 'foo' })
+ Post.where('comments.name' => 'foo')
+ Post.order('comments.name')
+
+ You also do not need to worry about this unless you are doing eager
+ loading. Basically, don't worry unless you see a deprecation warning
+ or (in future releases) an SQL error due to a missing JOIN.
+
+ [Jon Leighton]
+
* Support for the `schema_info` table has been dropped. Please
switch to `schema_migrations`.