From 05c79782f55ff136f69665ae8006bd2f6166e405 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sat, 2 Nov 2019 18:53:46 +0100 Subject: [PATCH] Ingredient create/import redirect to proper page --- app/controllers/ingredients_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/ingredients_controller.rb b/app/controllers/ingredients_controller.rb index 561eeeb..74d0a85 100644 --- a/app/controllers/ingredients_controller.rb +++ b/app/controllers/ingredients_controller.rb @@ -28,11 +28,10 @@ class IngredientsController < ApplicationController end def create - # FIXME: redirect to :back? @ingredient = @project.ingredients.new(ingredient_params) if @ingredient.save flash[:notice] = 'Created new ingredient' - redirect_to project_ingredients_url(@project) + redirect_to :back else prepare_ingredients @ingredient.nutrients.new(ingredient: @ingredient) if @ingredient.nutrients.empty? @@ -67,7 +66,6 @@ class IngredientsController < ApplicationController end def import - # FIXME: redirect to :back? warnings = [] if params.has_key?(:file) @@ -164,7 +162,7 @@ class IngredientsController < ApplicationController warnings.unshift("Problems encountered during import - fix and try again:") flash[:warning] = warnings.join("
").truncate(1024, omission: '...(and other)') end - redirect_to project_ingredients_url(@project) + redirect_to :back end private