Create a devise user from Ruby console

前端 未结 5 1343
广开言路
广开言路 2020-12-04 04:48

Any idea on how to create and save a new User object with devise from the ruby console?

When I tried to save it, I\'m getting always false. I guess I\'m missing some

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 05:25

    If you want to avoid sending confirmation emails, the best choice is:

        u = User.new({
          email: 'demo@greenant.com.br',
          password: '12feijaocomarroz',
          password_confirmation: '12feijaocomarroz'
        })
    
        u.confirm
        u.save
    

    So if you're using a fake email or have no internet connection, that'll avoid errors.

提交回复
热议问题