您好我最近发现了一种禁用我的ROR应用程序注册按钮的方法。该块似乎在应用于我的开发环境时起作用,但是在推送到Heroku时会在生产中崩溃,从而导致代码= H10应用程序崩溃。继承我使用的代码 -
application_controller.rb代码
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
Routes.rb代码
if Rails.env == 'production'
devise_for :users, :controllers => { :registrations => "registrations" }
else
devise_for :users
end