Permalink
Browse files

Forget about auto scope, it's always explicit.

  • Loading branch information...
1 parent 16ac353 commit 3e4452c73f6f7ce2ff197b75d375f66f4a250a03 @miloops miloops committed Jun 17, 2009
Showing with 6 additions and 7 deletions.
  1. +6 −7 activerecord/lib/active_record/base.rb
@@ -1736,7 +1736,7 @@ def construct_finder_sql(options)
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 @@ def construct_join(joins, scope = :auto)
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 @@ def construct_group(group, having, scope = :auto)
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 @@ def construct_order(order, scope = :auto)
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?

0 comments on commit 3e4452c

Please sign in to comment.