CanCan::Ability where is the current_user method defined?

后端 未结 2 1883
抹茶落季
抹茶落季 2021-01-26 08:43

Pretty much what I have mentioned in the title. I am using CanCan::Ability in my code to check permissions and abilities. It expects a current_user method to be defined. I am gu

相关标签:
2条回答
  • 2021-01-26 09:25

    current_user is implemented by devise in this eval'ed block (which, I believe is called indirectly by the devise_for(:user) in your config/routes.rb). If you want to override it, you should be able to define your own current_user method in your ApplicationController.

    0 讨论(0)
  • 2021-01-26 09:36

    It's found here in the source code. It's nothing to do with devise, though. The documentation is found above the method and describes overwriting it.

    0 讨论(0)
提交回复
热议问题