在我的数据库中,我有 3 个字段:
name, cost, active
我如何才能在选择(表单)中仅显示那些活动字段为真(1)的值?现在我有这样的代码:
= f.select :shipping_id, [["Select", "0"]] + @shippings.map{ |c| [c.name, c.id]}, {:required => true}
如何映射,仅当 active 为 true 时?
笔记!我必须只在眼前这样做!
在我的数据库中,我有 3 个字段:
name, cost, active
我如何才能在选择(表单)中仅显示那些活动字段为真(1)的值?现在我有这样的代码:
= f.select :shipping_id, [["Select", "0"]] + @shippings.map{ |c| [c.name, c.id]}, {:required => true}
如何映射,仅当 active 为 true 时?
笔记!我必须只在眼前这样做!