Fix vehicle name fallback not applied in select by replacing pluck with model instances

This commit is contained in:
2026-04-09 09:42:45 -04:00
parent cc94401a1f
commit 35542ba1b9
@@ -18,14 +18,18 @@ module Vehicles
def view_issues_form_details_bottom(context={})
# Load the customer's vehicles for selection in the issue form.
vehicles = context[:issue].customer&.vehicles || []
context[:controller].send(:render_to_string, {
partial: 'issues/form_hook_vehicles',
locals: {
vehicle: context[:form].select( :vehicle_id,
context[:issue].customer ? context[:issue].customer.vehicles.pluck(:name, :id) : [],
selected: context[:issue].vehicle ? context[:issue].vehicle.id : nil,
include_blank: true )
}
vehicle: context[:form].select(
:vehicle_id,
vehicles.map { |v| [v.name, v.id] },
selected: context[:issue].vehicle&.id,
include_blank: true
)
}
})
end