1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Support for :credentials on Rails v5.2.x. (#4712)

This fixes #4710.

Rails introduced :secrets in v5.1. They somehow changed it to :credentials. This fix represents this change.

Devise will now look :credentials first, then fallback to :secrets for 5.1.x compatibility then it will check for standard secret key. If three not found then exception will arise.
This commit is contained in:
Gencer W. Genç 2018-01-24 00:19:29 +03:00 committed by Leonardo Tegon
parent e55c9caa05
commit bdd6081815

View file

@ -34,7 +34,9 @@ module Devise
end end
initializer "devise.secret_key" do |app| initializer "devise.secret_key" do |app|
if app.respond_to?(:secrets) if app.respond_to?(:credentials)
Devise.secret_key ||= app.credentials.secret_key_base
elsif app.respond_to?(:secrets)
Devise.secret_key ||= app.secrets.secret_key_base Devise.secret_key ||= app.secrets.secret_key_base
elsif app.config.respond_to?(:secret_key_base) elsif app.config.respond_to?(:secret_key_base)
Devise.secret_key ||= app.config.secret_key_base Devise.secret_key ||= app.config.secret_key_base