Add Quantity #edit and #update

This commit is contained in:
2025-01-11 22:51:49 +01:00
parent adcc6699ce
commit d5e7ccacf5
5 changed files with 33 additions and 2 deletions

View File

@@ -26,6 +26,18 @@ class QuantitiesController < ApplicationController
end
end
def edit
end
def update
if @quantity.update(quantity_params.except(:parent_id))
@ancestors = @quantity.ancestors(include_self: true)
flash.now[:notice] = t('.success', quantity: @quantity)
else
render :edit
end
end
def destroy
@quantity.destroy!
@ancestors = @quantity.ancestors