表格,filelds_for 已订购

关于Rails 3 fields_for - sort order gets lost

依赖: Supplement has_many SubContractorSupplements

SubContractorSupplement属于SubContractor

Supplement 的公式中,我有一个嵌套表单(Simple_Form):

f.simple_fields_for :sub_contractor_supplements do |scs|

而且,我想通过 sub_contractor.cost_center_abacus

订购 sub_contractor_supplements

如果我在 SubContractorSupplement 上添加一个 default_scope,那会起作用,但随后我会更改排序顺序默认全局。

在Supplement上定义关系 has_many :sub_contractor_supplements,-> {order 'sub_contractor.cost_center_abacus ASC'} 没有用,因为我得到错误列 sub_contractor.cost_center_abacus 不存在。

因此,最好是可以直接在表单中定义排序顺序。

有什么建议吗?

谢谢,克里斯

qq975120043 回答:表格,filelds_for 已订购

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/258516.html

大家都在问