I had a rails app which was running perfectly with devise 3 and rails 4. I updated rails to 5 and it gave DEPRECATION WARNING: alias_method_chain is deprecated
. So i had to change the devise version to 4.0.0.rc1.
Now it seems like the devise is not generating the methods like authenticate_user!
, is_admin
etc..
I am getting the following error
Before process_action callback :authenticate_user! has not been defined (ArgumentError)
I tried everything including, uninstall devise and install again, then tried to create a separate model from scratch and still the methods are not defined.
Any ideas please ?
The answer for this is to simply change:
skip_before_action :authenticate_user!
to ---
skip_before_action :authenticate_user!, raise: false
https://github.com/plataformatec/devise/issues/4207 https://github.com/thoughtbot/clearance/issues/621
I could identify the issue, in rails 5, there will be an exception if the skipping method is not defined at the time of calling unless we add :unless
condition.
Until rails5 support lands in devise itself, you can try using this fork:
gem 'devise', github: 'twalpole/devise', branch: 'rails5'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With