4

我试过rake db:reset了,现在我无法访问它 admin@example.com|password 它在我登录时返回一个无效的用户/密码。我检查了我的数据库它在那里为什么会这样?

id          email              encrypted_password                                            reset_password_token  reset_password_sent_at  remember_created_at         sign_in_count  current_sign_in_at          last_sign_in_at             current_sign_in_ip  last_sign_in_ip  created_at                  updated_at                
----------  -----------------  ------------------------------------------------------------  --------------------  ----------------------  --------------------------  -------------  --------------------------  --------------------------  ------------------  ---------------  --------------------------  --------------------------
1           admin@example.com  $2a$10$cCUYBOKQHAZhpYgdLIZIWuQArkrsjpgIMu9/kk17127Oj.DKYwVxa                                                2012-04-19 15:23:02.857402  36             2012-04-25 02:37:36.689711  2012-04-25 02:31:55.088037  127.0.0.1           127.0.0.1        2012-03-09 16:23:58.779104  2012-04-25 02:37:36.692613
sqlite> 
4

2 回答 2

14

$ rails console
>> AdminUser.create :email => 'admin@example.com', :password => 'password', :password_confirmation => 'password'
于 2012-06-26T10:11:57.287 回答
5

我有同样的问题,我通过执行以下操作解决了它:

rake db:drop:all
rake db:create:all
rake db:migrate

我能够重新登录!

假设您不介意对所有内容进行完全重置!

于 2012-06-23T03:00:45.440 回答