aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/locking
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-07-21 23:01:26 -0300
committerEmilio Tagua <miloops@gmail.com>2009-07-21 23:01:26 -0300
commitca1e62f14219da3990bb354d4a363dbe6fa13435 (patch)
tree4afad396b527834fc693f572e329acc32d45cdd0 /activerecord/lib/active_record/locking
parent5123a2359b964ba31c93296a36c9899564b537a8 (diff)
downloadrails-ca1e62f14219da3990bb354d4a363dbe6fa13435.tar.gz
rails-ca1e62f14219da3990bb354d4a363dbe6fa13435.tar.bz2
rails-ca1e62f14219da3990bb354d4a363dbe6fa13435.zip
Performance: cache/reload arel relation when possible to speed up things.
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index bc22c2a511..4e833ec871 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -89,7 +89,7 @@ module ActiveRecord
attribute_names.uniq!
begin
- affected_rows = arel_table.where(
+ affected_rows = arel_table(true).where(
arel_table[self.class.primary_key].eq(quoted_id).and(
arel_table[self.class.locking_column].eq(quote_value(previous_value))
)
@@ -116,7 +116,7 @@ module ActiveRecord
lock_col = self.class.locking_column
previous_value = send(lock_col).to_i
- affected_rows = arel_table.where(
+ affected_rows = arel_table(true).where(
arel_table[self.class.primary_key].eq(quoted_id).and(
arel_table[self.class.locking_column].eq(quote_value(previous_value))
)