Skip to content

Instantly share code, notes, and snippets.

@rocodev-tech
Created July 7, 2014 07:38
Show Gist options
  • Save rocodev-tech/8b432d60f6d236916bc8 to your computer and use it in GitHub Desktop.
Save rocodev-tech/8b432d60f6d236916bc8 to your computer and use it in GitHub Desktop.
app/controllers/admin/products_controller.rb
class Admin::ProductsController < ApplicationController
def new
@product = Product.new
end
def create
@product = Product.new(product_params)
if @product.save
redirect_to admin_products_path
else
render :new
end
end
private
def product_params
params.require(:product).permit(:title, :description,:quantity)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment