我想使用 rolify 测试多个角色。
我试过这个,但没有用:
<% if current_user.has_role? [:technician, :admin] %>
谢谢您的帮助!
更新1
我正在尝试测试 :technician 或 :admin - 这有效,但似乎应该有更短的方法:
if current_user.has_role? :technician or current_user.has_role? :admin
最佳答案
我建议你测试类似 current_user.has_any_role? :technician, :admin
的东西,它应该返回您期望的 bool 值:)
关于ruby-on-rails - Rails Rolify 如何测试多个角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16111415/