Sha256: 4342656c0ea33c27a04d281e0ead9ab8787b6c8dbe72c7b17e8dea21f0a383fa

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

class OrdersController < ApplicationController
  before_action :set_order, only: [:show, :edit, :update, :destroy]

  autocomplete :client, :name
  #autocomplete :client, :name, ({ column_name: 'name', display_value: 'name', full_model: true })


  # GET /orders
  def index
    @orders = Order.all
  end

  # GET /orders/1
  def show
  end

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

  # GET /orders/1/edit
  def edit
  end

  # POST /orders
  def create
    @order = Order.new(order_params)

    if @order.save
      redirect_to @order, notice: 'Order was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /orders/1
  def update
    if @order.update(order_params)
      redirect_to @order, notice: 'Order was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /orders/1
  def destroy
    @order.destroy
    redirect_to orders_url, notice: 'Order was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_order
      @order = Order.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def order_params
      params[:order]
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap3_autocomplete_input-0.2.3 test/dummy/app/controllers/orders_controller.rb
bootstrap3_autocomplete_input-0.2.1 test/dummy/app/controllers/orders_controller.rb