Sha256: f683025da442f665ed2ad1dd6c3fc5587125abc4cbecdb0ed233c7c1ede766fb
Contents?: true
Size: 1.09 KB
Versions: 11
Compression:
Stored size: 1.09 KB
Contents
class OrdersController < ApplicationController before_action :set_order, only: [:show, :edit, :update, :destroy] autocomplete :client, :name # 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
11 entries across 11 versions & 1 rubygems