Seeding users with Devise in Ruby on Rails

后端 未结 14 2431
终归单人心
终归单人心 2020-12-14 00:59

In my development and test environments, I want to seed the database with a bunch of users. I\'m using Ruby on Rails v3.2.8 and the latest Devise. So I added this line in

14条回答
  •  感情败类
    2020-12-14 01:23

    Arun is right. It's easier just to do this in your seeds.rb

    user = User.create! :name => 'John Doe', :email => 'john@gmail.com', :password => 'topsecret', :password_confirmation => 'topsecret'
    

提交回复
热议问题