安装设置与自定义注册控制器 [英] Setup devise with custom registration controller
问题描述
我正在使用devise工作的铁路网站,我们不希望用户注册。用户认证是我们可以登录访问网站的限制部分,并添加/编辑我们认为合适的东西。所以现在我创建了以下控制器:
I'm working on a rails site using devise, where we do not want user sign ups just yet. User authentication is so we can login to access restricted parts of the site and add/edit things as we see fit. So for now, I created the following controller:
class Users::RegistrationController < Devise::SessionsController
def new
end
end
以这种方式设置我的路线:
And setup my routes in this fashion:
devise_for :users, :controllers => { :registration => "users/registration" }
但是,当我运行rake路由时,我仍然看到一个返回的值在注册控制器上创建动作。任何想法如何摆脱它?
However, when I run rake routes, I still see a returned value for the create action on the registration controller. Any ideas on how to get rid of it?
推荐答案
尝试使用:注册
而不是:注册
。此外,您的定制控制器类似乎应该通过以下方式定义:
Try using :registrations
instead of :registration
. Also, it seems like your custom controller class should be defined via:
class Users::RegistrationsController < Devise::RegistrationsController
这篇关于安装设置与自定义注册控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!