From 0ae107aac7de1728ce62b78312715c3e81ed873b Mon Sep 17 00:00:00 2001 From: Mikk Romulus Date: Thu, 15 Feb 2024 13:40:18 +0200 Subject: [PATCH] fix: Service not being update-able --- app/controllers/services_controller.rb | 2 +- app/models/concerns/vm_cache_buster.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 2b3ff3e2..b57ccaf6 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -34,7 +34,7 @@ def show end def update - if @service.update service_params + if authorize(@service).update(service_params) redirect_to [@service.exercise, @service], notice: 'Service was successfully updated.' else render :show, status: 400 diff --git a/app/models/concerns/vm_cache_buster.rb b/app/models/concerns/vm_cache_buster.rb index 86e7f6c2..5e3bcb11 100644 --- a/app/models/concerns/vm_cache_buster.rb +++ b/app/models/concerns/vm_cache_buster.rb @@ -31,6 +31,6 @@ def get_service self else service - end.tap { |s| s.reload if s.persisted? } + end.dup.tap { |s| s.reload if s.persisted? } end end