### Home Classes Methods

### In Files

- app/controllers/carts_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.

# CartsController

### Public Instance Methods

create() click to toggle source

POST /carts POST /carts.xml

        # File app/controllers/carts_controller.rb, line 49
    49:   def create

    50:     @cart = Cart.new(params[:cart])

    51:

    52:     respond_to do |format|

    53:       if @cart.save

    54:         format.html { redirect_to(@cart, :notice => 'Cart was successfully created.') }

    55:         format.xml  { render :xml => @cart, :status => :created, :location => @cart }

    56:       else

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

    58:         format.xml  { render :xml => @cart.errors, :status => :unprocessable_entity }

    59:       end

    60:     end

    61:   end

destroy() click to toggle source

DELETE /carts/1 DELETE /carts/1.xml

        # File app/controllers/carts_controller.rb, line 81
    81:   def destroy

    82:     @cart = current_cart

    83:     @cart.destroy

    84:     session[:cart_id] = nil

    85:

    86:     respond_to do |format|

    87:       format.html { redirect_to(store_url) }

    88:       format.xml { head :ok }

    89:     end

    90:   end

edit() click to toggle source

GET /carts/1/edit

        # File app/controllers/carts_controller.rb, line 43
    43:   def edit

    44:     @cart = Cart.find(params[:id])

    45:   end

index() click to toggle source

GET /carts GET /carts.xml

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

     7:     @carts = Cart.all

     8:

     9:     respond_to do |format|

    10:       format.html # index.html.erb

    11:       format.xml  { render :xml => @carts }

    12:     end

    13:   end

new() click to toggle source

GET /carts/new GET /carts/new.xml

        # File app/controllers/carts_controller.rb, line 33
    33:   def new

    34:     @cart = Cart.new

    35:

    36:     respond_to do |format|

    37:       format.html # new.html.erb

    38:       format.xml  { render :xml => @cart }

    39:     end

    40:   end

show() click to toggle source

GET /carts/1 GET /carts/1.xml

        # File app/controllers/carts_controller.rb, line 17
    17:   def show

    18:     begin

    19:       @cart = Cart.find(params[:id])

    20:     rescue ActiveRecord::RecordNotFound

    21:       logger.error "Pokus o přístup k neplatnému košíku #{params[:id]}"

    22:       redirect_to store_url, :notice => 'Neplatný košík'

    23:     else

    24:       respond_to do |format|

    25:         format.html # show.html.erb

    26:         format.xml { render :xml => @cart }

    27:       end

    28:     end

    29:   end

update() click to toggle source

PUT /carts/1 PUT /carts/1.xml

        # File app/controllers/carts_controller.rb, line 65
    65:   def update

    66:     @cart = Cart.find(params[:id])

    67:

    68:     respond_to do |format|

    69:       if @cart.update_attributes(params[:cart])

    70:         format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }

    71:         format.xml  { head :ok }

    72:       else

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

    74:         format.xml  { render :xml => @cart.errors, :status => :unprocessable_entity }

    75:       end

    76:     end

    77:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.