问题描述
我重写了RegistrationController my_devise /注册控制器
i覆盖了以下methos:
I overridden RegistrationController my_devise/Registration controlleri overridden the following methos:
def after_inactive_sign_up_path_for(资源)
awaiting_confirmation_path
def after_inactive_sign_up_path_for(resource) awaiting_confirmation_path
结束
我的RegistrationController中还有一个新方法,命名为:
def awaiting_confirmation(resource)
do凝灰岩....
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 => {
:registrationrations =>my_devise / registrations}
devise_for :accounts, :controllers => { :registrations => "my_devise/registrations"}
资源:注册做
匹配awaiting_confirmation= >注册#awaiting_confirmation
结束
resources :registration do match "awaiting_confirmation" => "registrations#awaiting_confirmation" end
我收到一条错误消息:
没有路由匹配{:action =>awaiting_confirmation,:控制器=>注册}
I get an error message:No route matches {:action=>"awaiting_confirmation", :controller=>"registrations"}
我做错了什么?
推荐答案
p>资源:注册做
匹配awaiting_confirmation =>注册#awaiting_confirmation
end
resources :registration do
match "awaiting_confirmation" => "registrations#awaiting_confirmation"
end
您在哪里指定您的注册控制器在my_devise文件夹?
您需要手动指定,因为Rails遵循约定,因此它在app / controllers目录中查找您自己编写的注册控制器。
要更多了解这一点,请看看 rake路由
命令的输出,并找到rails为其生成的路由。
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.
这篇关于无法使用after_inactive_sign_up_path_for进行路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!