3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/interactors/spree_cm_commissioner/vehicle_type_updater.rb', line 3
def call
vehicle_type = context.vehicle_type
data = context.data
option_value_ids = data[:option_value_ids] || []
option_type_ids = data[:option_type_ids] || []
ActiveRecord::Base.transaction do
update_vehicle_type!(vehicle_type, data[:vehicle_type_attributes])
update_amenities!(vehicle_type, option_value_ids, option_type_ids)
end
context.message = I18n.t('views.transit.vehicle_types.update_success')
rescue StandardError => e
context.fail!(message: "Failed to update vehicle type: #{e.message}")
end
|