diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-14 00:17:39 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-16 21:17:17 +0000 |
commit | 4429f16c0ada896fe3753324f0201b290c6425d9 (patch) | |
tree | db8234ec210f74346f40b4b0c1e200add3e33f66 /activerecord/lib/active_record | |
parent | 4c4760a619e9bddf14e65dd7f0d5bbc3f9ca320e (diff) | |
download | rails-4429f16c0ada896fe3753324f0201b290c6425d9.tar.gz rails-4429f16c0ada896fe3753324f0201b290c6425d9.tar.bz2 rails-4429f16c0ada896fe3753324f0201b290c6425d9.zip |
Make referencing an included item trigger eager loading
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 0f8ac33f6e..dcfce448b1 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -521,7 +521,8 @@ module ActiveRecord # always convert table names to downcase as in Oracle quoted table names are in uppercase joined_tables = joined_tables.flatten.compact.map { |t| t.downcase }.uniq - (tables_in_string(to_sql) - joined_tables).any? + (tables_in_string(to_sql) - joined_tables).any? || + (includes_values & references_values).any? end def tables_in_string(string) |