我有一个新安装Rails的,我试图建立认证与设计。 至于我可以告诉我有一个非常基本的设置应在工作,但每当我试图与形式的默认设计标志登录我得到一个未经授权的错误。 我相信我的凭据是正确的,因为我创建了一个用户,在像这样的控制台来进行测试:
User.new({:email=>'mark@markdavies.com.au', :priv_level => 'admin', :password=>'mypassword', :password_confirmation=>'mypassword'}).save
我的用户模型:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :confirmable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :priv_level, :unconfirmed_email
# attr_accessible :title, :body
has_one :supplier
end
我的日志:
Started POST "/admin/user/sign_in" for 127.0.0.1 at 2012-12-22 13:10:56 -0500
Processing by Admin::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"wYLsalxN9rTv8P8bvYuT0wZcvlFbu6b1SvoCyKtTCII=", "admin_user"=>{"email"=>"mark@markdavies.com.au", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'mark@markdavies.com.au' LIMIT 1
(0.1ms) begin transaction
(0.0ms) commit transaction
Completed 401 Unauthorized in 69ms
有什么办法,我可以得到什么从设计失败的更多信息? 当我创建控制台用户使用的加密不是通过形式有什么不同?