Sha256: 6116fc1928512d44f5753d1eff139de22bc5088e787673eda5df6c006b3c045c

Contents?: true

Size: 497 Bytes

Versions: 5

Compression:

Stored size: 497 Bytes

Contents

class BasketsController < ApplicationController

  
  include Restfulie::Server::ActionController::Base
  
  respond_to :xml, :json
  
  def create
    @basket = Basket.new
    params[:basket][:items].each do |item|
      puts item.class
      puts item[:id]
      @basket.items << Item.find(item[:id])
    end
    @basket.save
    render :text => "", :status => 201, :location => basket_url(@basket)
  end
  
  def show
    @basket = Basket.find(params[:id])
    respond_with @basket
  end


end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 full-examples/rest_from_scratch/part_2/app/controllers/baskets_controller.rb
restfulie-1.1.1 full-examples/rest_from_scratch/part_2/app/controllers/baskets_controller.rb
restfulie-1.1.0 full-examples/rest_from_scratch/part_2/app/controllers/baskets_controller.rb
restfulie-nosqlite-1.0.3 full-examples/rest_from_scratch/part_2/app/controllers/baskets_controller.rb
restfulie-1.0.3 full-examples/rest_from_scratch/part_2/app/controllers/baskets_controller.rb