CanCan不会将图像上传到服务器(ckeditor)

时间:2018-03-02 12:09:11

标签: ruby-on-rails ruby ckeditor monkeypatching cancancan

当我将图片上传到服务器时,请求Ckeditor::PicturesController#create(它位于gem ckeditor)并显示错误:

CanCan::AuthorizationNotPerformed (This action failed the check_authorization because it does not authorize_resource. Add skip_authorization_check to bypass this check.)

我怎么能不使用monkeypatching(未在skip_authorization_check中指定Ckeditor::PicturesController),并以 abillity.rb 或其他方式解决此问题

1 个答案:

答案 0 :(得分:2)

您是否尝试在 ability.rb 中添加以下规则,如docs中所述?

withContext(MyThreadPool) { heavyWork }