aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-03 03:27:14 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-03 03:46:08 +0530
commiteb7fdb94647c42e31370b7faa1a474a966053f4d (patch)
treedd92063bf58f8724c4d87f2df856ca07d821c930 /activerecord/lib/active_record/base.rb
parent6f5f23aaa7c4673fe923c6ad1450baaeccb40c02 (diff)
downloadrails-eb7fdb94647c42e31370b7faa1a474a966053f4d.tar.gz
rails-eb7fdb94647c42e31370b7faa1a474a966053f4d.tar.bz2
rails-eb7fdb94647c42e31370b7faa1a474a966053f4d.zip
Make Relation#includes behave exactly like the existing :include option
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb13
1 files changed, 2 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index b0bc7b928e..70776c7aa2 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1579,17 +1579,8 @@ module ActiveRecord #:nodoc:
order(construct_order(options[:order], scope)).
limit(construct_limit(options[:limit], scope)).
offset(construct_offset(options[:offset], scope)).
- from(options[:from])
-
- include_associations = merge_includes(scope && scope[:include], options[:include])
-
- if include_associations.any?
- if references_eager_loaded_tables?(options)
- relation = relation.eager_load(include_associations)
- else
- relation = relation.preload(include_associations)
- end
- end
+ from(options[:from]).
+ includes( merge_includes(scope && scope[:include], options[:include]))
lock = (scope && scope[:lock]) || options[:lock]
relation = relation.lock if lock.present?