diff --git a/CHANGELOG.md b/CHANGELOG.md index 30f829eaa..84913bb0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab-manager - Improved fix_invoice_item task +- Fix a bug: updating a space/machine/event/training removes the image - Fix a bug: cryptic error message when failed to create a manager - Fix a bug: unable to restore accounting periods closed by a deleted admin - Fix a bug: unable to build an acocunting archive if the operator was deleted diff --git a/app/controllers/api/events_controller.rb b/app/controllers/api/events_controller.rb index 12ccbf2c8..9937d63bc 100644 --- a/app/controllers/api/events_controller.rb +++ b/app/controllers/api/events_controller.rb @@ -95,7 +95,7 @@ class API::EventsController < API::ApiController :amount, :nb_total_places, :availability_id, :all_day, :recurrence, :recurrence_end_at, :category_id, :event_theme_ids, :age_range_id, event_theme_ids: [], - event_image_attributes: [:attachment], + event_image_attributes: %i[id attachment], event_files_attributes: %i[id attachment _destroy], event_price_categories_attributes: %i[id price_category_id amount _destroy], advanced_accounting_attributes: %i[code analytical_section]) diff --git a/app/controllers/api/machines_controller.rb b/app/controllers/api/machines_controller.rb index aabe63c92..4084bfab7 100644 --- a/app/controllers/api/machines_controller.rb +++ b/app/controllers/api/machines_controller.rb @@ -50,7 +50,7 @@ class API::MachinesController < API::ApiController def machine_params params.require(:machine).permit(:name, :description, :spec, :disabled, :machine_category_id, :plan_ids, :reservable, - plan_ids: [], machine_image_attributes: [:attachment], + plan_ids: [], machine_image_attributes: %i[id attachment], machine_files_attributes: %i[id attachment _destroy], advanced_accounting_attributes: %i[code analytical_section]) end diff --git a/app/controllers/api/spaces_controller.rb b/app/controllers/api/spaces_controller.rb index 4945ddb44..f155e1d81 100644 --- a/app/controllers/api/spaces_controller.rb +++ b/app/controllers/api/spaces_controller.rb @@ -50,7 +50,7 @@ class API::SpacesController < API::ApiController def space_params params.require(:space).permit(:name, :description, :characteristics, :default_places, :disabled, - space_image_attributes: [:attachment], + space_image_attributes: %i[id attachment], space_files_attributes: %i[id attachment _destroy], advanced_accounting_attributes: %i[code analytical_section]) end diff --git a/app/controllers/api/trainings_controller.rb b/app/controllers/api/trainings_controller.rb index ba7e78325..81b711ab3 100644 --- a/app/controllers/api/trainings_controller.rb +++ b/app/controllers/api/trainings_controller.rb @@ -76,7 +76,7 @@ class API::TrainingsController < API::ApiController def training_params params.require(:training) .permit(:id, :name, :description, :machine_ids, :plan_ids, :nb_total_places, :public_page, :disabled, - training_image_attributes: [:attachment], machine_ids: [], plan_ids: [], + training_image_attributes: %i[id attachment], machine_ids: [], plan_ids: [], advanced_accounting_attributes: %i[code analytical_section]) end end