如何让RedactorRails方法传递授权

时间:2013-07-31 18:09:31

标签: ruby-on-rails redactor

我使用redactor rails gem。

当我尝试上传图片时,我看到:

Started POST "/redactor_rails/pictures?authenticity_token=g1JQetiggTDMwYoG2CnVz5ilnBoXReONW9iwgt5%2FJy4%3D" for 127.0.0.1 at 2013-07-31 22:02:10 +0400
Processing by RedactorRails::PicturesController#create as HTML
#other logs

ActionController::RoutingError (No route matches {:controller=>"info", :action=>"app_index"}):
  app/controllers/application_controller.rb:55:in `authorize'

实际上指出这不会通过我的自定义授权:

  def authorize
     @current_permission = current_permission
     if @current_permission.allow?(params[:controller], params[:action])
        return true
      else
      redirect_to root_url
    end
  end

目前的许可是这样的:

   allow :controller, [:m1, m2, ....]
   allow :users, [:new,:create,:uniqueness, :show, :create_guest, :edit_user_by_reset, :update_pass, :email_confirmation]
   # so on

我尝试了什么:

   allow "RedactorRails::PicturesController", [:create]
   allow  :pictures, [:create]
   allow :redactor_rails, [:create]

这些都不起作用。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

   allow :"redactor_rails/pictures", [:index, :create]
   allow :"redactor_rails/documents", [:index, :create]

所以,主要的有用信息 - 就是你如何在某个地方声明控制器方法来匹配redactor