summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2018-12-27 15:46:32 +0100
committerDouwe Maan <douwe@selenight.nl>2018-12-27 15:46:32 +0100
commitfd27be93489d7485754895ffef161431bf268b3d (patch)
tree165ca4da9efddd749f044c0373aeb1987b97cd93 /config/initializers
parent77909a88460bbc864a5f95f3fa66053eb6cab5a8 (diff)
downloadgitlab-ce-fd27be93489d7485754895ffef161431bf268b3d.tar.gz
Make it clear that monkey patch is no longer needed in Rails 5.1
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb2
-rw-r--r--config/initializers/active_record_locking.rb7
2 files changed, 6 insertions, 3 deletions
diff --git a/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb b/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
index 3e765469995..228ced32188 100644
--- a/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
+++ b/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
@@ -20,7 +20,7 @@
#
# This bug was fixed in Rails 5.1 by https://github.com/rails/rails/pull/24745/commits/aa062318c451512035c10898a1af95943b1a3803
-if Rails.version.start_with?("5.1")
+if Rails.gem_version >= Gem::Version.new("5.1")
raise "Remove this monkey patch: #{__FILE__}"
end
diff --git a/config/initializers/active_record_locking.rb b/config/initializers/active_record_locking.rb
index bfe41e6029a..b8e8a0427e5 100644
--- a/config/initializers/active_record_locking.rb
+++ b/config/initializers/active_record_locking.rb
@@ -1,7 +1,10 @@
# rubocop:disable Lint/RescueException
-# Remove this monkey-patch when all lock_version values are converted from NULLs to zeros.
-# See https://gitlab.com/gitlab-org/gitlab-ce/issues/25228
+# Remove this monkey patch when we move to Rails 5.1, because the bug has been fixed in https://github.com/rails/rails/pull/26050.
+if Rails.gem_version >= Gem::Version.new("5.1")
+ raise "Remove this monkey patch: #{__FILE__}"
+end
+
module ActiveRecord
module Locking
module Optimistic