使用设计禁用注册

时间:2014-01-10 02:48:24

标签: heroku devise ruby-on-rails-4 production-environment

您好我最近发现了一种禁用我的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

0 个答案:

没有答案