gpt4 book ai didi

ruby-on-rails - Rails 3. 用于子关联的 ActiveAdmin 过滤器

转载 作者:太空宇宙 更新时间:2023-11-03 16:56:12 25 4
gpt4 key购买 nike

我的 cargo 只有一张发票;发票属于发货。当我尝试这样做时...

filter :customer, :collection => proc {(Customer.all).map{|c| [c.company_name, c.id]}}

O 收到此错误 (Mysql::Error: Unknown column 'invoices.customer_id'

customer_id 列实际上在 shipments 表中。由于发票属于装运,我通常通过执行 invoice.shipment.customer_id 来访问 customer_id。但我不知道如何实现它来创建一个 activeadmin 过滤器。

完整错误:SQLite3::SQLException:没有这样的列:invoices.customer_id: SELECT COUNT(DISTINCT count_column) FROM (SELECT "invoices"."id"AS count_column FROM "invoices"LEFT OUTER JOIN "customers"ON "customers"."id"= "invoices"."customer_id"LEFT OUTER JOIN "shipments"ON "shipments"."id"= "invoices"."shipment_id"WHERE "customers"."id"= 2 LIMIT 30偏移量 0) subquery_for_count

最佳答案

你能用Nested Attribute吗? ?

关于ruby-on-rails - Rails 3. 用于子关联的 ActiveAdmin 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8903536/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com