【问题标题】:Authentication with Devise in rails_api在 rails_api 中使用 Devise 进行身份验证
【发布时间】:2016-01-26 18:33:10
【问题描述】:

我已经使用了 devise 几次,它非常有用且节省时间,但在那些应用程序中我使用的是 erb templates 。现在我正在使用rails_api 制作一个rails api,简单的注册很麻烦。对于sign_up,当我拨打邮递员电话,例如localhost:3000/users?user[email]=abc@no.co&user[username]=abc&user[password]=12345(邮递电话)时,它会显示错误

未定义的局部变量或方法`resource' for # :0x000000051ad790>

在此之前我做了一些更改,然后它显示protect_from_forgery 的错误。谁能帮我解决这个问题:(并建议有更好的方法来使用设计或其他任何东西。提前致谢

【问题讨论】:

  • undefined local variable or method 'resource' for 什么?你能添加完整的错误吗?
  • @AndreyDeineko 请看一下,我更新了它

标签: ruby-on-rails ruby ruby-on-rails-4 devise


【解决方案1】:

devise 默认情况下不会与 rails_api 一起使用 你应该试试simple_token_authenticationdevise_token_auth

【讨论】:

猜你喜欢
  • 2012-06-15
  • 2014-01-04
  • 1970-01-01
  • 1970-01-01
  • 2014-12-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-18
相关资源
最近更新 更多