CanCan-访问被拒绝-使CanCan在LOG中指定的方法为什么? [英] CanCan - Access denied - Way to make CanCan Specify in the LOG Why?

查看:64
本文介绍了CanCan-访问被拒绝-使CanCan在LOG中指定的方法为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力实施CanCan。由于某些原因,当我尝试获取有关模型权限的详细信息时,CanCan会一直拒绝我的访问。而且我不知道为什么。

I'm working to implement CanCan. For some reason CanCan keeps giving me Access Denied when I try to get specific about model permissions. And I can't figure out why.

有没有办法让CanCan具体化,也许是在日志中或有关为什么拒绝Access的开发中?

Is there a way to get CanCan to be specific, perhaps in the logs or in development about Why Access is denied? something like, No Read Ability to XXX Model.

这对调试很有帮助。

谢谢 p>

Thanks

推荐答案

您可以在ApplicationController中添加 rescue_from 块以处理CanCan异常并进行设置您的自定义错误消息在那里。有关详细说明,请参见可以提供文档

You can add a rescue_from block in ApplicationController to handle CanCan exceptions and set your custom error message there. See the CanCan docs for a detailed explanation.

这篇关于CanCan-访问被拒绝-使CanCan在LOG中指定的方法为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆