aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-07-01 16:16:11 -0300
committerEmilio Tagua <miloops@gmail.com>2009-07-01 16:16:11 -0300
commit0f5785c99799b70919e18df3ef1cb43761979f5d (patch)
treea650dfb48806a37872ed12378256867219657d64
parenta9cd9f4c751d4664d8f0eaf3026e0792694c2244 (diff)
downloadrails-0f5785c99799b70919e18df3ef1cb43761979f5d.tar.gz
rails-0f5785c99799b70919e18df3ef1cb43761979f5d.tar.bz2
rails-0f5785c99799b70919e18df3ef1cb43761979f5d.zip
Small refactor to update_all.
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 56ed851d6a..e8793c3d2d 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -867,12 +867,12 @@ module ActiveRecord #:nodoc:
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))