Sha256: 66ab713277b4c43cca92900d8cfc013db0874a4d6184e87e9407570aea8b06c7

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

module PowerShop
  class OrdersController < PowerShop::ApplicationController

    # GET: create new order action
    # if order success created, redirect to success page
    #
    # Returns text/html
    def create
      @cart = cart
      @order_form = ::OrderForm.new(@cart, permited_params[:order_form])

      if @order_form.valid?
        if @order_form.perform
          flash[:order_id] = @order_form.order.id
          return redirect_to power_shop.success_order_url
        end
      end

      render :template => 'power_shop/cart/show'
    end

    # GET: show simple page for success message
    #
    # Returns text/html
    def success
    end

    protected
    def permited_params
       params.permit(order_form: [:user_name, :user_phone, :user_email])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
power_shop-0.1.1 app/controllers/power_shop/orders_controller.rb