diff options
| author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 15:06:43 -0800 | 
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 15:07:01 -0800 | 
| commit | 8c9b5e413ff9bab8607377223dd42a0ff4375405 (patch) | |
| tree | 30472fe71dbe97c476ec8a70e0b6b6132b002fe4 | |
| parent | ead0c6eed35c71cc990f8c5b6d98e20c6072c136 (diff) | |
| download | rails-8c9b5e413ff9bab8607377223dd42a0ff4375405.tar.gz rails-8c9b5e413ff9bab8607377223dd42a0ff4375405.tar.bz2 rails-8c9b5e413ff9bab8607377223dd42a0ff4375405.zip | |
removing more calls to deprecated methods
| -rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index c0e1dda2bd..e5065de7fb 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -87,11 +87,13 @@ module ActiveRecord            begin              relation = self.class.unscoped -            affected_rows = relation.where( +            stmt = relation.where(                relation.table[self.class.primary_key].eq(quoted_id).and(                  relation.table[lock_col].eq(quote_value(previous_value))                ) -            ).arel.update(arel_attributes_values(false, false, attribute_names)) +            ).arel.compile_update(arel_attributes_values(false, false, attribute_names)) + +            affected_rows = connection.update stmt.to_sql              unless affected_rows == 1                raise ActiveRecord::StaleObjectError, "Attempted to update a stale object: #{self.class.name}" | 
