Rails 3 ActiveAdmin。根据 CanCan 权限隐藏按钮
我让 ActiveAdmin 和 CanCan 一起工作。我已经设置了管理员和客户权限。
现在我想根据 CanCan 设置的权限隐藏“新建”、“编辑”和“删除”按钮,但以下行给了我错误...
config.clear_action_items! :if => proc{can? (:destroy, Shipment)}
这也是
:if => proc{ can?(:destroy, Shipment)}, actions :all, :except => [:new, :create, :update, :edit, :destroy]
I have ActiveAdmin and CanCan working together. I already set the administrator and customer permissions.
Now I want to hide the New, Edit and Delete buttons according to the permissions set by CanCan but the following line gives me errors...
config.clear_action_items! :if => proc{can? (:destroy, Shipment)}
This one too
:if => proc{ can?(:destroy, Shipment)}, actions :all, :except => [:new, :create, :update, :edit, :destroy]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用这个猴子补丁在显示按钮之前检查权限
I use this monkey patch to check permissions before displaying buttons