Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #12011 - Replace .includes(table).where(table) by .eager_load
On Rails 3, .includes(:users).where("users.name = 'daniel'") works because Rails would be smart enough to figure out the where query uses the includes table. In this case it'd internally resolve it to eager_load to use the table users in the query. However on Rails 4 they decided they didn't want to maintain a parser for SQL, so we have to append .references(:table) after every .includes(:table).where("SQL that uses table"). This is not retrocompatible, but we can directly use eager_load on Rails 3 and 4 to avoid using .references.
- Loading branch information
Showing
6 changed files
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters