Gem 请教我在使用 rubychina 中 devise 的 private_token 认证的一个错误

mobiwolf · 2012年11月15日 · 最后由 mobiwolf 回复于 2012年11月16日 · 2114 次阅读

hi,我在弄一个 demo,就是采取 rubychina 现在的 grape 的 api 使用的认证方式。

我拷贝了,sessions_controller 和 account_controller 两个文件

并且根据我的需求生成了 Devise User.rb 文件,里面有 private_token 和 update_private_token 方法。

但是我在 debugger 的时候,发现如下的问题:

在 SessionsController 的 create 函数中的 resource = nil

上下文环境:

resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")

其中: 1,resource_name = user 2,controller_path = "sessions"

为什么 resource 会为空呢?

是我问的没水平,还是问题太简单了?为啥没一个人回复呢?如果我的问题描述的不对,请帮忙指点一下。谢谢~~

谁可以帮助我一下呢?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号