I'm using Devise Token Auth gem and, everytime I run my test suite in Rails 4.2.5 app, I'm getting this deprecation warning from Devise:
DEPRECATION WARNING: [Devise] config.email_regexp will have a new default on Devise 4.1 To keep the current behavior please set in your config/initializers/devise.rb the following:
Devise.setup do |config|
config.email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
end
If you want to use the new default:
Devise.setup do |config|
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
end
(called from block in tsort_each at /usr/local/lib/ruby/2.2.0/tsort.rb:226)
I've already added config/initializers/devise.rb file manually and have set email_regex as suggested by the message above, but the annoying message persists.
How can I disable this message?
@yovasx2 That's weird, are you calling Devise.setup
in others places of your application? Maybe some gem are you using? If you update your Devise to 4.1.1
the message will stop anyway.
No I don't call it in other places:
Searching 335 files for "Devise.setup" (case sensitive)
/home/joe/just-eat/config/initializers/devise.rb:
1 # Use this hook to configure devise mailer, warden hooks and so forth.
2 # Many of these configuration options can be set straight in your model.
3: Devise.setup do |config|
4 # The secret key used by Devise. Devise uses this key to generate
5 # random tokens. Changing this key will render invalid all existing
/home/joe/just-eat/log/development.log:
<binary>
/home/joe/just-eat/log/test.log:
<binary>
521 matches across 3 files
I executed bundle update to get last devise version and I still have the message
I just send the message to log as I answered here
I had the same problem.
(Context: brand-spankin' new rails (4.2.6) app, only a few hours old; everything is still very much default.)
I wouldn't suggest sending all deprecation warnings to the log, as @yovasx2 suggests. That seems like a bad solution -- you might miss other, important deprecations :)
The bleeding-edge of devise_token_auth gem supports Devise 4.1 as of a few weeks ago. Others with this issue might also try changing their Gemfile to read
gem "devise_token_auth", github: "lynndylanhurley/devise_token_auth"
dem "devise", "~>4.1.1"
until the next release of devise_token_auth comes out.
Regarding the actual bug:
It appears that the deprecation warning is triggered before any initializers have been loaded or run -- if I put a print statement at the top of config/initializers/devise.rb
, it doesn't appear until after the warning.
yovasx2 Any news on this issue?
Most helpful comment
I had the same problem.
(Context: brand-spankin' new rails (4.2.6) app, only a few hours old; everything is still very much default.)
I wouldn't suggest sending all deprecation warnings to the log, as @yovasx2 suggests. That seems like a bad solution -- you might miss other, important deprecations :)
The bleeding-edge of devise_token_auth gem supports Devise 4.1 as of a few weeks ago. Others with this issue might also try changing their Gemfile to read
until the next release of devise_token_auth comes out.
Regarding the actual bug:
It appears that the deprecation warning is triggered before any initializers have been loaded or run -- if I put a print statement at the top of
config/initializers/devise.rb
, it doesn't appear until after the warning.