Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails devise delete register

I'm sorry if this is a dumb question. But if i set up devise, how would i completely remove the ability of a user to signup. I could easily remove the signup views, but what else. Should i add something like devise_for :user, :except => register, or what? The reason im doing this, is because i want the database to be only seeded with users.

like image 258
Kevin Avatar asked Nov 14 '11 21:11

Kevin


2 Answers

You are almost right:

devise_for :users, :skip => :registrations

Documentation.

like image 162
iain Avatar answered Nov 18 '22 19:11

iain


You should have on your models something like this:

class User < ActiveRecord::Base
   devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable
end

To remove the signup, you should remove the registerable module, so you module should be like this:

class User < ActiveRecord::Base
   devise :database_authenticatable, :recoverable, :confirmable, :rememberable, :trackable, :validatable
end
like image 42
Rodrigo Flores Avatar answered Nov 18 '22 20:11

Rodrigo Flores