aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/locking
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-08-08 23:27:54 +0100
committerJon Leighton <j@jonathanleighton.com>2011-08-08 23:28:23 +0100
commit7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0 (patch)
treec878847de183caa1c3807e5253baf7d1fdfe0f65 /activerecord/lib/active_record/locking
parentff9a2e66975e8a5c9cc361ec1fd61980cd14eb3e (diff)
downloadrails-7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0.tar.gz
rails-7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0.tar.bz2
rails-7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0.zip
Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
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 6cfce6e573..d9ad7e4132 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -70,7 +70,7 @@ module ActiveRecord
# If the locking column has no default value set,
# start the lock version at zero. Note we can't use
- # <tt>locking_enabled?</tt> at this point as
+ # <tt>locking_enabled?</tt> at this point as
# <tt>@attributes</tt> may not have been initialized yet.
if result.key?(self.class.locking_column) && lock_optimistically
@@ -100,7 +100,7 @@ module ActiveRecord
)
).arel.compile_update(arel_attributes_values(false, false, attribute_names))
- affected_rows = connection.update stmt.to_sql
+ affected_rows = connection.update stmt
unless affected_rows == 1
raise ActiveRecord::StaleObjectError, "Attempted to update a stale object: #{self.class.name}"