From 3e4452c73f6f7ce2ff197b75d375f66f4a250a03 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 17 Jun 2009 15:10:57 -0300 Subject: Forget about auto scope, it's always explicit. --- activerecord/lib/active_record/base.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3f2b56d0c4..e04ec54913 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1736,7 +1736,7 @@ module ActiveRecord #:nodoc: construct_finder_arel(options).to_sql end - def construct_join(joins, scope = :auto) + def construct_join(joins, scope) merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins]) case merged_joins when Symbol, Hash, Array @@ -1753,13 +1753,12 @@ module ActiveRecord #:nodoc: end end - def construct_group(group, having, scope = :auto) + def construct_group(group, having, scope) sql = '' if group sql << group.to_s sql << " HAVING #{sanitize_sql_for_conditions(having)}" if having else - scope = scope(:find) if :auto == scope if scope && (scoped_group = scope[:group]) sql << scoped_group.to_s sql << " HAVING #{sanitize_sql_for_conditions(scope[:having])}" if scope[:having] @@ -1768,7 +1767,7 @@ module ActiveRecord #:nodoc: sql end - def construct_order(order, scope = :auto) + def construct_order(order, scope) orders = [] scoped_order = scope[:order] if scope if order @@ -1780,17 +1779,17 @@ module ActiveRecord #:nodoc: orders end - def construct_limit(options, scope = :auto) + def construct_limit(options, scope) options[:limit] ||= scope[:limit] if scope options[:limit] end - def construct_offset(options, scope = :auto) + def construct_offset(options, scope) options[:offset] ||= scope[:offset] if scope options[:offset] end - def construct_conditions(conditions, scope = :auto) + def construct_conditions(conditions, scope) conditions = [conditions] conditions << scope[:conditions] if scope conditions << type_condition if finder_needs_type_condition? -- cgit v1.2.3