Don't duplicate ancestors search in #successive

This commit is contained in:
2025-01-12 18:11:37 +01:00
parent 421515e5ce
commit 17b4e4f8a7
2 changed files with 5 additions and 15 deletions

View File

@@ -19,7 +19,8 @@ class QuantitiesController < ApplicationController
def create
@quantity = current_user.quantities.new(quantity_params)
if @quantity.save
@before, @quantity, @ancestors = @quantity.succ_and_ancestors
@before = @quantity.successive
@ancestors = @quantity.ancestors
flash.now[:notice] = t('.success', quantity: @quantity)
else
render :new