RAILS:Authlogic gem& Userstamp插件
-
05-07-2019 - |
题
我有一个使用 Authlogic gem 并且需要功能 Userstamp 插件。
AFAIK Userstamp 与 RestfulAuthentication配合得很好 ,虽然我找不到任何与 Authlogic 一起使用它的内容。
有没有人试图将它们合并?我应该注意哪些问题?我是否应该使用完全不同的插件/ gem来将 Userstamp 的功能与 Authlogic 结合使用?
非常感谢你的帮助!
解决方案
好吧,我刚刚发现它很难。 ; - )
如果将Authlogic(2.0.11)与Userstamp(2.0)结合使用,请确保ActionController中的Authlogic的 current_user
方法是 protected
而不是 private
(默认情况下)。或者你会在User sessionsController#new 中得到 NoMethodError。
除此之外,它就像魅力一样。
P.S。:无需在ActionController中手动实现 set_stamper
方法。 Authlogic和Userstamp可以很好地使用Userstamp插件定义的方法。如果你不知道我在说什么,那就忽略它吧。 : - )
不隶属于 StackOverflow