mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-08 22:37:57 -05:00
Bring back `Devise.activerecord51? and deprecate it
Even though this is considered an internal / non-public / nodoc method, it seems some libraries relied on it internally, causing some breakage. Known libraries so far are `devise-security` and `devise-pwned_password`. Closes #5580
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
### Unreleased
|
||||
|
||||
|
||||
* deprecations
|
||||
* Bring back `Devise.activerecord51?` and deprecate it, in order to avoid breakage with some libraries that apparently relied on it.
|
||||
|
||||
### 4.9.1 - 2023-03-31
|
||||
|
||||
|
||||
@@ -520,6 +520,14 @@ module Devise
|
||||
b.each_byte { |byte| res |= byte ^ l.shift }
|
||||
res == 0
|
||||
end
|
||||
|
||||
def self.activerecord51? # :nodoc:
|
||||
ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] `Devise.activerecord51?` is deprecated and will be removed in the next major version.
|
||||
It is a non-public method that's no longer used internally, but that other libraries have been relying on.
|
||||
DEPRECATION
|
||||
defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
||||
end
|
||||
end
|
||||
|
||||
require 'warden'
|
||||
|
||||
@@ -106,4 +106,8 @@ class DeviseTest < ActiveSupport::TestCase
|
||||
assert_no_match Devise.email_regexp, email
|
||||
end
|
||||
end
|
||||
|
||||
test 'Devise.activerecord51? deprecation' do
|
||||
assert_deprecated { Devise.activerecord51? }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user