Permalink
Browse files

Small refactor to update_all.

  • Loading branch information...
1 parent a9cd9f4 commit 0f5785c99799b70919e18df3ef1cb43761979f5d @miloops miloops committed Jul 1, 2009
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/base.rb
@@ -867,12 +867,12 @@ def update_all(updates, conditions = nil, options = {})
arel = arel.where(Arel::SqlLiteral.new(conditions))
end
- if options.has_key?(:limit) || (scope && scope[:limit])
+ arel = if options.has_key?(:limit) || (scope && scope[:limit])
# Only take order from scope if limit is also provided by scope, this
# is useful for updating a has_many association with a limit.
- arel = arel.order(construct_order(options[:order], scope)).take(construct_limit(options, scope))
+ arel.order(construct_order(options[:order], scope)).take(construct_limit(options, scope))
else
- arel = arel.order(construct_order(options[:order], nil))
+ arel.order(construct_order(options[:order], nil))
end
arel.update(sanitize_sql_for_assignment(updates))

0 comments on commit 0f5785c

Please sign in to comment.