Created
July 7, 2014 07:38
-
-
Save rocodev-tech/8b432d60f6d236916bc8 to your computer and use it in GitHub Desktop.
app/controllers/admin/products_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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