diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-02 04:02:09 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-02 04:02:09 -0300 |
commit | 3fd467e9ed7f3a8d408ab2cb0782a5b13bb3f629 (patch) | |
tree | 92534a2643b96332d51e52b8ab5236e1ac4fa018 /activerecord/lib/active_record/locking | |
parent | c9896884a46eb96508fc3e0d2a10be47eb195826 (diff) | |
download | rails-3fd467e9ed7f3a8d408ab2cb0782a5b13bb3f629.tar.gz rails-3fd467e9ed7f3a8d408ab2cb0782a5b13bb3f629.tar.bz2 rails-3fd467e9ed7f3a8d408ab2cb0782a5b13bb3f629.zip |
Refactor to use arel_table method, and also use the same method name for instance and class methods.
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index f66458cc8c..a4f5dd8516 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -89,9 +89,9 @@ module ActiveRecord attribute_names.uniq! begin - affected_rows = table.where( - table[self.class.primary_key].eq(quoted_id).and( - table[self.class.locking_column].eq(quote_value(previous_value)) + affected_rows = arel_table.where( + arel_table[self.class.primary_key].eq(quoted_id).and( + arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) ).update(arel_attributes_values(false, false, attribute_names)) @@ -116,9 +116,9 @@ module ActiveRecord lock_col = self.class.locking_column previous_value = send(lock_col).to_i - affected_rows = table.where( - table[self.class.primary_key].eq(quoted_id).and( - table[self.class.locking_column].eq(quote_value(previous_value)) + affected_rows = arel_table.where( + arel_table[self.class.primary_key].eq(quoted_id).and( + arel_table[self.class.locking_column].eq(quote_value(previous_value)) ) ).delete |