diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 97b7b8cd1ef4d..ced8b8360c078 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,12 @@ ## Rails 4.0.0 (unreleased) ## +* When using optimisitc locking, `update` whas not passing the column type 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 + + *Alfred Wong* + * Do not log the binding values for binary columns. *Matthew M. Boedicker* diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 23925163953cb..9c890011687e4 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -1,4 +1,5 @@ require 'thread' +require 'mocha/setup' require "cases/helper" require 'models/person' require 'models/job' @@ -26,6 +27,18 @@ class ReadonlyNameShip < Ship class OptimisticLockingTest < ActiveRecord::TestCase fixtures :people, :legacy_things, :references, :string_key_objects, :peoples_treasures + def test_quote_value_passed_lock_col + p1 = Person.find(1) + assert_equal 0, p1.lock_version + + Person.expects(:quote_value).with(0, Person.columns_hash[Person.locking_column]).returns('0').once + + p1.first_name = 'anika2' + p1.save! + + assert_equal 1, p1.lock_version + end + def test_non_integer_lock_existing s1 = StringKeyObject.find("record1") s2 = StringKeyObject.find("record1")