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,13 +18,17 @@ 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
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user