PUNDIT“无法找到范围” Pundit索引错误/ ruby​​上的红宝石

问题描述

我在Pundit和索引策略方面遇到了一些问题:我希望@line_items仅是current_user的line_items,这是我的代码

def index
    @line_items = current_user.orders.map(&:line_items).flatten
    policy_scope(@line_items)
  end

和专家

class LineItemPolicy < ApplicationPolicy
  class Scope < Scope
    def resolve
      scope.all
    end
  end

  def index?
    true
  end
end

我收到此错误消息“无法为`[#LineItem::LineItem::LineItemPolicy::Scope”

你能帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)