【发布时间】:2021-11-01 18:14:25
【问题描述】:
我有 Invoice 类 belongs_to Invoiceable,一个多态类。 Invoice 的Invoiceable 可以是Subscription 或Purchase。
我需要能够按发票的Subscription 或Purchase 的状态进行搜索。
我正在尝试以下方法,但没有成功:
<%= f.check_box :invoiceable_of_Subscription_or_Purchase_type_status_in, { multiple: true }, type[1], false %>
我尝试了不同的组合,例如:
<%= f.check_box :invoiceable_of_Subscription_type_or_invoiceable_of_Purchase_type_status_in, { multiple: true }, type[1], false %>
但我总是收到Polymorphic associations do not support computing the class. 错误。
这可能吗? Ransack 文档仅说明了如何通过单个多态关联模型进行搜索。
【问题讨论】:
标签: ruby-on-rails ruby search filter ransack