0
我使用redactor rails gem。如何让RedactorRails方法通过授权
当我尝试上传图片,我看到:
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]
没有效果。
任何想法?
匹配主编虽然它并没有解决您的问题*(我想看到你的'让'和'? current_permission'方法)*,我喜欢指出** [pundit](https://github.com/elabs/pundit)** gem,当我看到像这样脆弱的定制授权时。 – deefour
@Deefour,你错了,它是基于RailsCast教师,并像100万的cancan一样工作,只是自定义 –
我不确定我错了什么,因为我只是建议一个经过充分测试,受欢迎的**轻量**替代您当前的授权。如果你对我提到它是'脆弱的',我表示歉意,但是这似乎是你寻求帮助的问题的根源。 – deefour