diff --git a/app/controllers/ingredients_controller.rb b/app/controllers/ingredients_controller.rb index 6c43825..561eeeb 100644 --- a/app/controllers/ingredients_controller.rb +++ b/app/controllers/ingredients_controller.rb @@ -41,12 +41,12 @@ class IngredientsController < ApplicationController end def destroy - # FIXME: redirect to :back? # FIXME: don't destroy if any meal depend on ingredient if @ingredient.destroy flash[:notice] = 'Deleted ingredient' end - redirect_to project_ingredients_url(@project) + prepare_ingredients + render :toggle end def toggle diff --git a/app/views/ingredients/_list.html.erb b/app/views/ingredients/_list.html.erb index 10c652e..350ead2 100644 --- a/app/views/ingredients/_list.html.erb +++ b/app/views/ingredients/_list.html.erb @@ -27,7 +27,9 @@ <%= i.source.name if i.source.present? %> <%= ", #{i.source_ident}" if i.source_ident.present? %> - <%= delete_link ingredient_path(i), data: {} %> + + <%= delete_link ingredient_path(i), {remote: true, data: {}} %> + <% end %> diff --git a/app/views/ingredients/create.html.erb b/app/views/ingredients/create.html.erb deleted file mode 100644 index 7936ded..0000000 --- a/app/views/ingredients/create.html.erb +++ /dev/null @@ -1 +0,0 @@ -

IngredientsController#create

diff --git a/app/views/ingredients/destroy.html.erb b/app/views/ingredients/destroy.html.erb deleted file mode 100644 index 0e45f4e..0000000 --- a/app/views/ingredients/destroy.html.erb +++ /dev/null @@ -1 +0,0 @@ -

IngredientsController#destroy