diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 6d71fc3..65b79e7 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -23,6 +23,7 @@ class ProductsController < ApplicationController def update @product = Product.find(params[:id]) if @product.update_attributes(product_params) + flash[:success] = "Succesfully updated product" redirect_to action: :index else render 'edit' @@ -31,6 +32,7 @@ class ProductsController < ApplicationController def destroy Product.find(params[:id]).destroy + flash[:success] = "Succesfully removed product" redirect_to products_path end diff --git a/app/views/application/_flash.html.erb b/app/views/application/_flash.html.erb new file mode 100644 index 0000000..312b24d --- /dev/null +++ b/app/views/application/_flash.html.erb @@ -0,0 +1,26 @@ +