Allow to reparent Quantity everywhere

Closes #61
This commit is contained in:
2025-01-14 15:57:12 +01:00
parent 8524beefdc
commit 201359de3e
4 changed files with 11 additions and 4 deletions

View File

@@ -43,7 +43,8 @@ class QuantitiesController < ApplicationController
permitted = params.require(:quantity).permit(:parent_id)
@previous_ancestors = @quantity.ancestors
@quantity.update!(permitted)
# Until UI blocks all disallowed reparents, render error messages if present
render_no_content(@quantity) unless @quantity.update(permitted)
@ancestors = @quantity.ancestors
@quantity.depth = @ancestors.length