Not able to route using after_inactive_sign_up_pat

2019-09-02 05:59发布

问题:

I overridden RegistrationController my_devise/Registration controller i overridden the following methos:

def after_inactive_sign_up_path_for(resource) awaiting_confirmation_path

end

I also have a new method in my RegistrationController named: def awaiting_confirmation(resource) do tuff....
end

My routing file looks likethis:

devise_for :accounts, :controllers => { :registrations => "my_devise/registrations"}

resources :registration do match "awaiting_confirmation" => "registrations#awaiting_confirmation" end

I get an error message: No route matches {:action=>"awaiting_confirmation", :controller=>"registrations"}

What am i doing wrong?

回答1:

resources :registration do
match "awaiting_confirmation" => "registrations#awaiting_confirmation"
end

Where are you specifying that your registrations controller is in my_devise folder??
You need to specify that manually, because Rails follows conventions, and therefore its looking in the app/controllers directory to find the registrations controller, that you have written yourself.
To get more idea about this, have a look at the output of rake routes command and find the route that rails has generated for it.