Ruby on rails RubyonRails设计:可注册删除返回错误
我想从我的rails应用程序中删除注册页面,因为我使用的是仅邀请系统,我读到我必须从我的用户模型中删除Ruby on rails RubyonRails设计:可注册删除返回错误,ruby-on-rails,devise,Ruby On Rails,Devise,我想从我的rails应用程序中删除注册页面,因为我使用的是仅邀请系统,我读到我必须从我的用户模型中删除:可注册的模块,以便我的注册页面消失 当我这样做时,会出现以下错误: NoMethodError in Devise::RegistrationsController#new undefined method `new_with_session' for #<Class:0x007ffb53b8f820> 我认为你也必须覆盖注册控制器 class RegistrationsCon
:可注册的
模块,以便我的注册页面消失
当我这样做时,会出现以下错误:
NoMethodError in Devise::RegistrationsController#new
undefined method `new_with_session' for #<Class:0x007ffb53b8f820>
我认为你也必须覆盖注册控制器
class RegistrationsController < Devise::RegistrationsController
def new
flash[:info] = 'Registrations are not open yet, but please check back soon'
redirect_to root_path
end
def create
flash[:info] = 'Registrations are not open yet, but please check back soon'
redirect_to root_path
end
end
类注册控制器
我是从获得的,您只需从模型中删除:registable。在重新启动应用程序之前,所描述的错误将一直发生。我知道现在已经很长时间了,但这并不能阻止任何人遇到同样的问题,因为我几分钟前刚刚遇到过这个问题 最好的解决方案是在从您的模型中删除
:registable
后重新启动应用程序
designe:database\u authenticable,:recoverable,:rememberable,:trackable,:validable,:registable
变成
设计:数据库可验证、可恢复、可记忆、可跟踪、可验证
但是,如果您仍然有点想让人们了解为什么无法注册,我会建议任何人使用公认的答案
谢谢。在生产或开发服务器方面仍然看不到任何差异。。。samei的所有工作都必须在controllers文件夹中创建一个designe文件夹,以使其正常工作
class RegistrationsController < Devise::RegistrationsController
def new
flash[:info] = 'Registrations are not open yet, but please check back soon'
redirect_to root_path
end
def create
flash[:info] = 'Registrations are not open yet, but please check back soon'
redirect_to root_path
end
end