【发布时间】:2016-11-16 20:14:01
【问题描述】:
我正在尝试在 ActionJob 中呈现模板以通过 ActionCable 进行广播。
ApplicationController.render(partial: "messages/message", locals: { message: message }, assigns: { current_user: user}).squish
在大多数情况下,这可以正常工作,但是我的一些模板在视图中使用 Punit 进行授权。
<% if policy(message).show? %>
<%= message.body %>
<% end %>
这会在作业运行时引发错误。
ActionView::Template::Error: Devise could not find the `Warden::Proxy` instance on your request environment.
快速谷歌搜索发现这个问题:https://github.com/plataformatec/devise/issues/4271
票证和链接中提到,没有可用的 env['warden'] 因为没有执行中间件来添加它。
我该如何解决这个问题?
【问题讨论】:
-
你检查this了吗?
-
@ArunKumar 是的,这是票证中引用的链接之一。
标签: ruby-on-rails devise pundit actioncable