diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-13 23:42:07 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-16 21:17:17 +0000 |
commit | d13627d532f23b248a9141511c16abdf5746a486 (patch) | |
tree | b307474e4ba22771acaedf9cba0a237e2219aad4 /activerecord/lib/active_record | |
parent | 247d274cabae827766c1c5b9deb34fb34548fc5e (diff) | |
download | rails-d13627d532f23b248a9141511c16abdf5746a486.tar.gz rails-d13627d532f23b248a9141511c16abdf5746a486.tar.bz2 rails-d13627d532f23b248a9141511c16abdf5746a486.zip |
Revert "Deprecate implicit eager loading. Closes #950."
This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
Diffstat (limited to 'activerecord/lib/active_record')
6 files changed, 5 insertions, 19 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 8a17f0ced4..bdbcdb13fa 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -20,7 +20,7 @@ module ActiveRecord # It's okay to just apply all these like this. The options will only be present if the # association supports that option; this is enforced by the association builder. scope = scope.apply_finder_options(options.slice( - :readonly, :include, :eager_load, :order, :limit, :joins, :group, :having, :offset, :select)) + :readonly, :include, :order, :limit, :joins, :group, :having, :offset, :select)) if options[:through] && !options[:include] scope = scope.includes(source_options[:include]) diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index 776f0d0469..d4f59100e8 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -1,7 +1,7 @@ module ActiveRecord::Associations::Builder class Association #:nodoc: class_attribute :valid_options - self.valid_options = [:class_name, :foreign_key, :select, :conditions, :include, :eager_load, :extend, :readonly, :validate] + self.valid_options = [:class_name, :foreign_key, :select, :conditions, :include, :extend, :readonly, :validate] # Set by subclasses class_attribute :macro diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 298decb0f1..779f8164cc 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -100,7 +100,6 @@ module ActiveRecord scope = scope.select(preload_options[:select] || options[:select] || table[Arel.star]) scope = scope.includes(preload_options[:include] || options[:include]) - scope = scope.eager_load(preload_options[:eager_load] || options[:eager_load]) if options[:as] scope = scope.where( diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 97898c53ae..ad6374d09a 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -53,7 +53,6 @@ module ActiveRecord else if options[:conditions] through_options[:include] = options[:include] || options[:source] - through_options[:eager_load] = options[:eager_load] || options[:source] through_options[:conditions] = options[:conditions] end diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index bf1de4ba9d..3d6478c918 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- require 'active_support/core_ext/object/blank' -require 'active_support/deprecation' module ActiveRecord # = Active Record Relation @@ -522,18 +521,7 @@ 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 - referenced_tables = (tables_in_string(to_sql) - joined_tables) - if referenced_tables.any? - ActiveSupport::Deprecation.warn( - "Your query appears to reference tables (#{referenced_tables.join(', ')}) that are not " \ - "explicitly joined. This implicit joining is deprecated, so you must explicitly " \ - "reference the tables. For example, instead of Author.includes(:posts).where(\"posts.name = 'foo'\"), " \ - "you should write Author.eager_load(:posts).where(\"posts.name = 'foo'\")." - ) - true - else - false - end + (tables_in_string(to_sql) - joined_tables).any? end def tables_in_string(string) diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index de639a48f2..c25570d758 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -122,7 +122,7 @@ module ActiveRecord result end - VALID_FIND_OPTIONS = [ :conditions, :include, :joins, :limit, :offset, :extend, :eager_load, + VALID_FIND_OPTIONS = [ :conditions, :include, :joins, :limit, :offset, :extend, :order, :select, :readonly, :group, :having, :from, :lock ] def apply_finder_options(options) @@ -133,7 +133,7 @@ module ActiveRecord finders = options.dup finders.delete_if { |key, value| value.nil? && key != :limit } - ([:joins, :select, :group, :order, :having, :limit, :offset, :from, :lock, :readonly, :eager_load] & finders.keys).each do |finder| + ([:joins, :select, :group, :order, :having, :limit, :offset, :from, :lock, :readonly] & finders.keys).each do |finder| relation = relation.send(finder, finders[finder]) end |