aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2013-07-20 20:15:48 -0700
committerBen Woosley <ben.woosley@gmail.com>2013-07-22 04:39:38 -0700
commitc083dc22dd16c3c2e43bbe1e13e4ee210c2adbc1 (patch)
tree9143603fa3a614693b750178197e45c32f15bdfb /activerecord
parent39b5bfe2394d0a4d479b41ee8d170e0f6c65fd59 (diff)
downloadrails-c083dc22dd16c3c2e43bbe1e13e4ee210c2adbc1.tar.gz
rails-c083dc22dd16c3c2e43bbe1e13e4ee210c2adbc1.tar.bz2
rails-c083dc22dd16c3c2e43bbe1e13e4ee210c2adbc1.zip
Tidy up the "Specified column type for quote_value" changes
This includes fixing typos in changelog, removing a deprecated mocha/setup test require, and preferring the `column_for_attribute` accessor over direct access to the columns_hash in the new code.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md5
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb2
-rw-r--r--activerecord/test/cases/locking_test.rb1
3 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 8ab9a64244..76174dc398 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,7 +1,8 @@
-* When using optimisitc locking, `update` whas not passing the column type to `quote_value`
+* When using optimistic locking, `update` was not passing the column to `quote_value`
to allow the connection adapter to properly determine how to quote the value. This was
affecting certain databases that use specific colmn types.
- Fix #6763
+
+ Fixes: #6763
*Alfred Wong*
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index a1501ee453..626fe40103 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -82,7 +82,7 @@ module ActiveRecord
stmt = relation.where(
relation.table[self.class.primary_key].eq(id).and(
- relation.table[lock_col].eq(self.class.quote_value(previous_lock_value, self.class.columns_hash[lock_col]))
+ relation.table[lock_col].eq(self.class.quote_value(previous_lock_value, column_for_attribute(lock_col)))
)
).arel.compile_update(arel_attributes_with_values_for_update(attribute_names))
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb
index 4a72b69848..dfa12cb97c 100644
--- a/activerecord/test/cases/locking_test.rb
+++ b/activerecord/test/cases/locking_test.rb
@@ -1,5 +1,4 @@
require 'thread'
-require 'mocha/setup'
require "cases/helper"
require 'models/person'
require 'models/job'