aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-04-28 00:23:50 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-06-21 00:46:23 +0300
commit4d1264cb5afb93dba198dc559c22a88521fc45c4 (patch)
treefff3410cce7656b2b149528e3f60a39b4775dc12 /activerecord/lib/active_record
parent890de7705257323d05c8831b8c1ab43433b0ba89 (diff)
downloadrails-4d1264cb5afb93dba198dc559c22a88521fc45c4.tar.gz
rails-4d1264cb5afb93dba198dc559c22a88521fc45c4.tar.bz2
rails-4d1264cb5afb93dba198dc559c22a88521fc45c4.zip
Fix ActiveRecord::Persistence#touch with locking
`ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and `locking_column`, without default value, is null in the database.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/persistence.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index f652c7c3a1..b2dba5516e 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -526,7 +526,7 @@ module ActiveRecord
if locking_enabled?
locking_column = self.class.locking_column
- scope = scope.where(locking_column => _read_attribute(locking_column))
+ scope = scope.where(locking_column => read_attribute_before_type_cast(locking_column))
changes[locking_column] = increment_lock
end