Create a devise user from Ruby console

You can add false to the save method to skip the validations if you want.

User.new({:email => "guy@gmail.com", :roles => ["admin"], :password => "111111", :password_confirmation => "111111" }).save(false)

Otherwise I’d do this

User.create!({:email => "guy@gmail.com", :roles => ["admin"], :password => "111111", :password_confirmation => "111111" })

If you have confirmable module enabled for devise, make sure you are setting the confirmed_at value to something like Time.now while creating.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)