### Home Classes Methods

### In Files

- app/controllers/orders_controller.rb

### Parent

ApplicationController

### Methods

- #create
- #destroy
- #edit
- #index
- #new
- #show
- #update

### Files

- README_FOR_APP

### Class Index

Quicksearch

- AdminController
- AdminHelper
- ApplicationController
- ApplicationHelper
- Cart
- CartsController
- CartsHelper
- LineItem
- LineItemsController
- LineItemsHelper
- Notifier
- Order
- OrdersController
- OrdersHelper
- Product
- ProductsController
- ProductsHelper
- SessionsController
- SessionsHelper
- StoreController
- StoreHelper
- User
- UsersController
- UsersHelper

No matching classes.

# OrdersController

### Public Instance Methods

create() click to toggle source

POST /orders POST /orders.xml

        # File app/controllers/orders_controller.rb, line 51
    51:   def create

    52:     @order = Order.new(params[:order])

    53:     @order.add_line_items_from_cart(current_cart)

    54:

    55:     respond_to do |format|

    56:       if @order.save

    57:         Cart.destroy(session[:cart_id])

    58:         session[:cart_id] = nil

    59:         Notifier.order_received(@order).deliver

    60:         format.html { redirect_to(store_url, :notice => I18n.t('.thanks')) }

    61:         format.xml  { render :xml => @order, :status => :created, :location => @order }

    62:       else

    63:         format.html { render :action => "new" }

    64:         format.xml  { render :xml => @order.errors, :status => :unprocessable_entity }

    65:       end

    66:     end

    67:   end

destroy() click to toggle source

DELETE /orders/1 DELETE /orders/1.xml

        # File app/controllers/orders_controller.rb, line 87
    87:   def destroy

    88:     @order = Order.find(params[:id])

    89:     @order.destroy

    90:

    91:     respond_to do |format|

    92:       format.html { redirect_to(orders_url) }

    93:       format.xml  { head :ok }

    94:     end

    95:   end

edit() click to toggle source

GET /orders/1/edit

        # File app/controllers/orders_controller.rb, line 45
    45:   def edit

    46:     @order = Order.find(params[:id])

    47:   end

index() click to toggle source

GET /orders GET /orders.xml

        # File app/controllers/orders_controller.rb, line 6
     6:   def index

     7:     @orders = Order.paginate :page=>params[:page], :order=>'created_at desc',

     8:                              :per_page => 10

     9:

    10:     respond_to do |format|

    11:       format.html # index.html.erb

    12:       format.xml  { render :xml => @orders }

    13:     end

    14:   end

new() click to toggle source

GET /orders/new GET /orders/new.xml

        # File app/controllers/orders_controller.rb, line 29
    29:   def new

    30:     @cart = current_cart

    31:     if @cart.line_items.empty?

    32:       redirect_to store_url, :notice => "Košík je prázdný"

    33:       return

    34:     end

    35:

    36:     @order = Order.new

    37:

    38:     respond_to do |format|

    39:       format.html # new.html.erb

    40:       format.xml  { render :xml => @order }

    41:     end

    42:   end

show() click to toggle source

GET /orders/1 GET /orders/1.xml

        # File app/controllers/orders_controller.rb, line 18
    18:   def show

    19:     @order = Order.find(params[:id])

    20:

    21:     respond_to do |format|

    22:       format.html # show.html.erb

    23:       format.xml  { render :xml => @order }

    24:     end

    25:   end

update() click to toggle source

PUT /orders/1 PUT /orders/1.xml

        # File app/controllers/orders_controller.rb, line 71
    71:   def update

    72:     @order = Order.find(params[:id])

    73:

    74:     respond_to do |format|

    75:       if @order.update_attributes(params[:order])

    76:         format.html { redirect_to(@order, :notice => 'Order was successfully updated.') }

    77:         format.xml  { head :ok }

    78:       else

    79:         format.html { render :action => "edit" }

    80:         format.xml  { render :xml => @order.errors, :status => :unprocessable_entity }

    81:       end

    82:     end

    83:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.