Comments (6)
Thanks @ckraybill, that's nice! It looks like you can also do this to keep it DRY where you are specifying the secret key base, whether it's ENV or elsewhere:
Devise.setup do |config|
config.secret_key = Rails.application.secret_key_base
end
from devise.
No monkey patching needed, you can just configure Devise's secret_key in your setup:
Devise.setup do |config|
config.secret_key = ENV['SECRET_KEY_BASE'] # or whatever is your preferred method
end
Devise will only want to use the SecretKeyFinder if it isn't already configured.
from devise.
For those looking for an immediate fix, it is possible to monkey_patch around the issue. Add the following in your initializers/devise.rb:
class Devise::SecretKeyFinder
def find
@application.secret_key_base
end
end
from devise.
Issue is caused by Devise::SecretKeyFinder#find
method. Devise is currently trying to find a secret key in credentials
, secrets
and config
before checking the application itself, deprecation warning is triggered on every call to Rails.application.secrets
.
Is there any reason why we need SecretKeyFinder any more? I assume it was required to cover various rails version, but now devise dropped support for rails < 6.0, so there's always secret_key_base
on application object
from devise.
Hello,
I wanted to report that I am facing a similar issue with the deprecation warning related to Rails.application.secrets
. However, this issue appears for me only when running tests.
My environment details:
- Ruby: 3.2.2
- Rails: 7.1.1
- Devise: 4.9.3
I would appreciate any assistance or recommendations on how to resolve this issue.
Kind regards,
George S.
from devise.
For clarity, here's the PR to resolve this issue: #5645. (There were a couple PRs, it seems we should focus on this one.)
from devise.
Related Issues (20)
- Sorbet support for Devise Controllers
- ActionController::InvalidAuthenticityToken in Devise::SessionsController#create HOT 14
- "Encrypted password" is actually "Hash" of the password. Does it need to be renamed?
- Error during failsafe response: uncaught throw :warden HOT 1
- `confirmation_sent_at` is set regardless `skip_confirmation_notification!` method call HOT 1
- Resend confirmation instructions triggering error HOT 1
- Replace [data-turbo-cache=false] with [data-turbo-temporary]
- `parent_mailer` config option boot error
- Converting views from Erb to Haml causes them to be ignored by Devise HOT 1
- How to prevent to send a confirmation email when email field is updated ? #903 HOT 1
- Active Job integration clarification HOT 1
- user.update_with_password ignores password_confirmation
- Deprecation warning about Rails.application.secrets on rails 7.1 HOT 2
- Example for 7.1.0 is effectively useless HOT 4
- This might change behavior slightly in that we were humanizing the error reason before... I'd prefer if we just let all messages read that I think.
- Unprocessable Entity even after upgrading HOT 7
- common 'issue' with Devise Recoverable, password reset loop HOT 1
- format: false does not work
- Rails 7.1.3.3 NameError: uninitialized constant ApplicationRecord (NameError) HOT 1
- Missing route path_names for proper translation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devise.