Sha256: 142e4848efcf12ab91687c88fb746670a700066292d8e127b2a7b13b6fb54717

Contents?: true

Size: 536 Bytes

Versions: 6

Compression:

Stored size: 536 Bytes

Contents

class ProductsController < ApplicationController
  def index
    @products = Product.all
  end

  def new
    @product = Product.new
  end

  def create
    @product = Product.new(params[:product])
    if @product.save
      redirect_to products_path
    else
      render :new
    end
  end

  def edit
    @product = Product.find(params[:id])
  end

  def update
    @product = Product.find(params[:id])
    if @product.update_attributes(params[:product])
      redirect_to products_path
    else
      render :edit
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
token_field-1.1.0 spec/dummy/app/controllers/products_controller.rb
token_field-1.0.1 spec/dummy/app/controllers/products_controller.rb
token_field-1.0.0 spec/dummy/app/controllers/products_controller.rb
token_field-0.0.3 spec/dummy/app/controllers/products_controller.rb
token_field-0.0.2 spec/dummy/app/controllers/products_controller.rb
token_field-0.0.1 spec/dummy/app/controllers/products_controller.rb