Ruby on rails Rails找不到我的一个控制器
我正在尝试在我的设计注册中自定义注册后路径。根据,我创建了一个名为Ruby on rails Rails找不到我的一个控制器,ruby-on-rails,Ruby On Rails,我正在尝试在我的设计注册中自定义注册后路径。根据,我创建了一个名为therapists\u registrations\u controller.rb的新控制器,但当我启动服务器并加载页面时,我得到ActionController::RoutingError(未初始化的常量治疗师注册控制器) 现在,therapists\u registrations\u controller.rb位于app/controllers/api/therapists\u registrations\u control
therapists\u registrations\u controller.rb
的新控制器,但当我启动服务器并加载页面时,我得到ActionController::RoutingError(未初始化的常量治疗师注册控制器)
现在,therapists\u registrations\u controller.rb
位于app/controllers/api/therapists\u registrations\u controller.rb
,所有其他控制器都加载,我不玩任何带有自动加载路径的游戏。有什么问题吗
这是在Rails 3.2.11上。控制器的代码为:
class TherapistsRegistrationsController < Devise::RegistrationsController
protected
def after_inactive_sign_up_path_for(resource)
"http://google.com"
end
end
职业治疗师注册控制器
原因之一可能是类名。由于在app/controllers/api中有therapists\u registrations\u controller.rb
,因此类名应为
class Api::TherapistsRegistrationsController < Devise::RegistrationsController
到
你可以发布你的路线文件吗,你是否使用了deveave\u for:users,:controllers=>{:registrations=>“therapists\u registrations”}
以下是相关部分:deveave\u for:therapists,:controllers=>{:registrations=>“therapists\u registrations”}
。治疗师注册\u controller.rb
的路径是什么app/api
或app/controllers/api
?这是app/controllers/api/therapists\u registrations\u controller.rb
@Johnny Ok。另外,请尝试将此design\u for:therapists,:controllers=>{:registrations=>“therapists\u registrations”}
更改为design\u for:therapists,:controllers=>{:registrations=>“api/therapists\u registrations”}
devise_for :therapists, :controllers => { :registrations => "therapists_registrations" }
devise_for :therapists, :controllers => { :registrations => "api/therapists_registrations" }