Fix SQLite query compatibility inside WITH clause

Rename model methods to #succeeding.
This commit is contained in:
2026-10-18 02:34:57 +02:00
parent 9c51887024
commit f04c8d85be
5 changed files with 54 additions and 31 deletions
+4 -3
View File
@@ -19,7 +19,7 @@ class QuantitiesController < ApplicationController
def create
@quantity = current_user.quantities.new(quantity_params)
if @quantity.save
@before = @quantity.successive
@before = @quantity.succeeding
@ancestors = @quantity.ancestors
flash.now.notice = t('.success', quantity: @quantity)
else
@@ -45,8 +45,9 @@ class QuantitiesController < ApplicationController
if @quantity.update(permitted)
@ancestors = @quantity.ancestors
@self_and_progenies = @quantity.with_progenies
@before = @self_and_progenies.last.successive
# TODO: simplify into 1 query (see #succeeding comment)
@quantities = @quantity.with_progenies
@before = @quantities.last.succeeding
else
# Until UI blocks all disallowed reparents, render error messages if present.
flash.now.alert = @quantity.errors.full_messages
+2 -2
View File
@@ -18,7 +18,7 @@ class UnitsController < ApplicationController
def create
@unit = current_user.units.new(params.expect(Unit::ATTRIBUTES))
if @unit.save
@before = @unit.successive
@before = @unit.succeeding
flash.now.notice = t('.success', unit: @unit)
else
render_errors @unit
@@ -45,7 +45,7 @@ class UnitsController < ApplicationController
@previous_base = @unit.base
@unit.update!(unit_params)
@before = @unit.successive
@before = @unit.succeeding
if @unit.multiplier_previously_changed?
flash.now.notice = t(".multiplier_reset", unit: @unit)
end