我在用着cancan
and cells
我的 ruby-on-rails 项目中的 gems。如何访问can?
细胞内的方法?
Thanks.
我必须这样做。尝试
class MyCell < Cell::Rails
include CanCan::ControllerAdditions
end
如果您也使用 Devise,我必须这样做:
class MyCell < Cell::Rails
include CanCan::ControllerAdditions
include Devise::Controllers::Helpers
Devise::Controllers::Helpers.define_helpers(Devise::Mapping.new(:user, {}))
end
#define_helpers
会添加帮助方法,例如 current_user 和 user_signed_in 吗?到细胞。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)