无法查询postgres表以查找使用Devise创建的模型

时间:2017-04-18 02:24:55

标签: ruby-on-rails postgresql devise ruby-on-rails-5

我很难过并希望得到一些帮助。

使用设计4.2.1和rails 5.0。成功设置设计模型并创建资源。然而,当我尝试在rails控制台中查询管理表时,我收到此错误:

  2.4.0 :003 > User.all
    User Load (0.5ms)  SELECT "users".* FROM "users"
   => #<ActiveRecord::Relation []> 
  2.4.0 :004 > Admin.all
    Admin Load (1.4ms)  SELECT "admins".* FROM "admins"
  ArgumentError: wrong number of arguments (given 0, expected 1)
    from /Users/nonni/.rvm/gems/ruby-2.4.0@spree/gems/devise-4.2.1/lib/devise/models/database_authenticatable.rb:157:in `password_digest'
    from /Users/nonni/.rvm/gems/ruby-2.4.0@spree/gems/activemodel-5.0.2/lib/active_model/serialization.rb:135:in `block in serializable_hash'
    from /Users/nonni/.rvm/gems/ruby-2.4.0@spree/gems/activemodel-5.0.2/lib/active_model/serialization.rb:135:in `each'
    from /Users/nonni/.rvm/gems/ruby-2.4.0@spree/gems/activemodel-
    from /Users/nonni/.rvm/gems/ruby-2.4.0@spree/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

这一行特别是出现错误的地方:

4.2.1/lib/devise/models/database_authenticatable.rb:157:in `password_digest' from /Users/nonni/.rvm/gems/ruby 2.4.0@spree/gems/activemodel-  

当我检查postico时,我看到新创建的记录:

2 rand@user.com $2a$11$X9IcCMq9rSIz/QzTmoXfi.Se1nximWq8rRjAClpqJHgbPArJbqGAW1 2017-04-18 2017-04-18 (removed other_time_steps) 

管理员表({{​​3}})上没有password_digest列。

当我尝试在控制台中创建新的管理员时,我也会遇到同样的错误。我可能会错过什么?非常感谢任何指针。谢谢!

0 个答案:

没有答案