Creating an admin user in Devise on Rails beta 3

前端 未结 6 1252
梦谈多话
梦谈多话 2020-12-22 16:35

Ok, I\'m probably going to feel quite dumb when someone answers this one with a simple thing that I\'m missing but... here goes:

I\'ve got a brand new app on rails 3

6条回答
  •  清酒与你
    2020-12-22 17:21

    Yup. I feel dumb.

    If anyone else is having a similarly vapid moment. Just use the rails console to create the admin user:

    ➡ rails c
    Loading development environment (Rails 3.0.0.beta3)
    irb(main):001:0> admin = Admin.create! do |u|
    irb(main):002:1* u.email = 'sample@sample.com'
    irb(main):003:1> u.password = 'password'
    irb(main):004:1> u.password_confirmation = 'password'
    irb(main):005:1> end
    

    That will do it. Now just visit your admin sign in path and sign in.

提交回复
热议问题