Reputation: 1170
Following the confirm link in the email that gets sent for a user signup gives this error:
uninitialized constant Confirmation
NameError in Devise::ConfirmationsController#show
But if I turn off Cancancan
by removing load_and_authorize_resource
in the ApplicationController
, the error doesn't happen and the user can successfully follow the confirm link.
I've tried adding skip_load_and_authorize_resource
in an overrided Devise controller for the Confirmations-- Users::ConfirmationsController < Devise::ConfirmationsController
.
Upvotes: 0
Views: 185
Reputation: 1
The load_and_authorize_resource
shouldn’t be used in the ApplicationController
, because it is not compatible with the devices and controllers that do not have models with the same name. Instead, set load_and_authorize_resource
in each controller as needed.
Upvotes: 0
Reputation: 6418
The possibilities according to your explanation are:
uninitialized constant Confirmation
might be that it is trying to find out the model associated with this controller using the controller name and the result it gets is Confirmation
but there is no model with that name.skip_load_and_authorize_resource
might not work until you have the show
action in your overrided controller itself (adding a before action on child class should not work on parent class I think)I am not sure if this will work or not but you can try something like this and see in your ApplicationController
:
load_and_authorize_resource unless: :devise_controller?
So this will skip that before_action
for all devise controllers.
Upvotes: 1