forked from fixin.me/fixin.me
Fix SQLite query compatibility inside WITH clause
Rename model methods to #succeeding.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user