如何在下拉列表中显示每辆车的布尔活动属性? 即凯美瑞 - 活跃 吉普车 - 停用 协议 - 积极
= select("drivers_vehicle", "vehicle_id", Vehicle.accessible_by(current_ability).all.collect { |o| [o.name, o.id] })
答案 0 :(得分:2)
= select("drivers_vehicle", "vehicle_id", Vehicle.accessible_by(current_ability).all.collect { |o| ["#{o.name} - #{o.active ? 'active' : 'deactivated'}", o.id] })
答案 1 :(得分:0)
= select("drivers_vehicle", "vehicle_id", Vehicle.accessible_by(current_ability).all.collect { |o| ["#{o.name} - #{o.active}", o.id] })