Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to populate some default users in Devise?

I'm working on trying to get Devise working in my Rails app. I'm a new Rails user. What's the proper way to add a few default users?

like image 401
bigdaveyl Avatar asked Nov 20 '11 17:11

bigdaveyl


Video Answer


1 Answers

The normal way to set up any default data in Rails is by adding the data in db/seeds.rb:

user1 = User.create :name => "User1", :email => "[email protected]", :password => "user123"

Depending on your validations and devise features you might need to enter more fields. In order to use that data you just call rake db:seed.

rake db:migrate
rake db:seed
like image 51
halfdan Avatar answered Oct 19 '22 05:10

halfdan