Method: Effective::OrdersController#create

Defined in:
app/controllers/effective/orders_controller.rb

#createObject

Confirms an order from the cart.



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/effective/orders_controller.rb', line 38

def create
  @order ||= Effective::Order.new(view_context.current_cart)
  EffectiveOrders.authorize!(self, :create, @order)

  @order.assign_attributes(checkout_params)

  if (@order.confirm! rescue false)
    redirect_to(effective_orders.order_path(@order))
  else
    flash.now[:danger] = "Unable to proceed: #{flash_errors(@order)}. Please try again."
    render :new
  end
end