tap/app/controllers/products_controller.rb
2014-11-24 21:45:32 +01:00

32 lines
510 B
Ruby

class ProductsController < ApplicationController
def new
@product = Product.new
end
def create
@product = Product.new(params_products)
if @product.save
redirect_to @product
else
render "new"
end
end
def show
@product = Product.find(params[:id])
end
def edit
end
def delete
end
private
def params_products
params.require(:product).permit(:name, :purchase_price, :sale_price,
:img_path)
end
end