Sha256: dde6e27b363b7fd0ef41734c9adad734b5a156463032065ba451bd8b116340ba

Contents?: true

Size: 1.85 KB

Versions: 11

Compression:

Stored size: 1.85 KB

Contents

class OrdersController < ApplicationController
  # GET /orders
  # GET /orders.json
  def index
    @orders = Order.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @orders }
    end
  end

  # GET /orders/1
  # GET /orders/1.json
  def show
    @order = Order.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @order }
    end
  end

  # GET /orders/new
  # GET /orders/new.json
  def new
    @order = Order.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @order }
    end
  end

  # GET /orders/1/edit
  def edit
    @order = Order.find(params[:id])
  end

  # POST /orders
  # POST /orders.json
  def create
    @order = Order.new(params[:order])

    respond_to do |format|
      if @order.save
        format.html { redirect_to @order, notice: 'Order was successfully created.' }
        format.json { render json: @order, status: :created, location: @order }
      else
        format.html { render action: "new" }
        format.json { render json: @order.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /orders/1
  # PUT /orders/1.json
  def update
    @order = Order.find(params[:id])

    respond_to do |format|
      if @order.update_attributes(params[:order])
        format.html { redirect_to @order, notice: 'Order was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @order.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /orders/1
  # DELETE /orders/1.json
  def destroy
    @order = Order.find(params[:id])
    @order.destroy

    respond_to do |format|
      format.html { redirect_to orders_url }
      format.json { head :no_content }
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
opay-1.0.9 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.8 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.7 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.6 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.5 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.4 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.3 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.1 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.0 spec/dummy/app/controllers/orders_controller.rb
opay-1.0.0.beta spec/dummy/app/controllers/orders_controller.rb
simple_form_class-0.9.0 test/dummy/app/controllers/orders_controller.rb