0

I want to remove the registration page from my rails app since i am going with invitation only system and i have read that i have to remove the :registrable module from my user model in order for my sign up page to disappear...

when i do it i get the following error:

NoMethodError in Devise::RegistrationsController#new

undefined method `new_with_session' for #<Class:0x007ffb53b8f820>

here is the devise line from user.rb

devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable 
stergosz
  • 5,754
  • 13
  • 62
  • 133

3 Answers3

1

I think you have to override the registration controller also.

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

I got it from disabling Devise registration for production environment only

Community
  • 1
  • 1
az7ar
  • 5,187
  • 2
  • 19
  • 23
1

You simply need to remove the :registrable from the model. The error described will occur until you restart the application

Will
  • 8,102
  • 5
  • 30
  • 32
0

Well, I know this is quite some time now, but it doesn't stop anyone from running into the same problem since I just experienced this few minutes ago.

The best solution is just to restart your application after removing :registrable from your model such

devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :registrable

becomes

devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable.

But if you still somewhat wants to carry people along why Sign Up is not available, I will advice anyone to go with the accepted answer.

Thanks.

Afolabi Olaoluwa
  • 1,898
  • 3
  • 16
  • 37