aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/locking
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2017-08-23 16:08:34 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-10-23 12:50:46 -0400
commit63cf15877bae859ff7b4ebaf05186f3ca79c1863 (patch)
treea44d48a738159d2db928fc5aa68bd24b85fc8679 /activerecord/lib/active_record/locking
parente65aff70696be52b46ebe57207ebd8bb2cfcdbb6 (diff)
downloadrails-63cf15877bae859ff7b4ebaf05186f3ca79c1863.tar.gz
rails-63cf15877bae859ff7b4ebaf05186f3ca79c1863.tar.bz2
rails-63cf15877bae859ff7b4ebaf05186f3ca79c1863.zip
Rase when calling `lock!` in a dirty record
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r--activerecord/lib/active_record/locking/pessimistic.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/locking/pessimistic.rb b/activerecord/lib/active_record/locking/pessimistic.rb
index 72bccd4906..bb85c47e06 100644
--- a/activerecord/lib/active_record/locking/pessimistic.rb
+++ b/activerecord/lib/active_record/locking/pessimistic.rb
@@ -63,12 +63,13 @@ module ActiveRecord
def lock!(lock = true)
if persisted?
if changed?
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Locking a record with unpersisted changes is deprecated and will raise an
- exception in Rails 5.2. Use `save` to persist the changes, or `reload` to
- discard them explicitly.
+ raise(<<-MSG.squish)
+ Locking a record with unpersisted changes is not supported. Use
+ `save` to persist the changes, or `reload` to discard them
+ explicitly.
MSG
end
+
reload(lock: lock)
end
self