You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
404 B
23 lines
404 B
class ProductsController < ApplicationController
|
|
def index
|
|
@products = Product.all
|
|
end
|
|
|
|
def new
|
|
@transgression = Product.new
|
|
end
|
|
|
|
def create
|
|
@transgression = Product.new(product_params)
|
|
|
|
if @transgression.save
|
|
redirect_to products_path
|
|
else
|
|
render :new
|
|
end
|
|
end
|
|
def product_params
|
|
return params.require(:product).permit(:name, :description)
|
|
end
|
|
end
|