mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-07-01 16:11:08 -04:00
Fix vehicle name fallback not applied in select by replacing pluck with model instances
This commit is contained in:
@@ -18,14 +18,18 @@ module Vehicles
|
|||||||
def view_issues_form_details_bottom(context={})
|
def view_issues_form_details_bottom(context={})
|
||||||
|
|
||||||
# Load the customer's vehicles for selection in the issue form.
|
# Load the customer's vehicles for selection in the issue form.
|
||||||
|
vehicles = context[:issue].customer&.vehicles || []
|
||||||
|
|
||||||
context[:controller].send(:render_to_string, {
|
context[:controller].send(:render_to_string, {
|
||||||
partial: 'issues/form_hook_vehicles',
|
partial: 'issues/form_hook_vehicles',
|
||||||
locals: {
|
locals: {
|
||||||
vehicle: context[:form].select( :vehicle_id,
|
vehicle: context[:form].select(
|
||||||
context[:issue].customer ? context[:issue].customer.vehicles.pluck(:name, :id) : [],
|
:vehicle_id,
|
||||||
selected: context[:issue].vehicle ? context[:issue].vehicle.id : nil,
|
vehicles.map { |v| [v.name, v.id] },
|
||||||
include_blank: true )
|
selected: context[:issue].vehicle&.id,
|
||||||
}
|
include_blank: true
|
||||||
|
)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user