# HG changeset patch # User moriq # Date 1205114689 -32400 # Node ID a995025031b33ce36a7224536b96e6302b2c0fe7 # Parent b97ed3573af26c43ef1a11fa26bdc54deaa7ec9a 'Add to Cart'をorder_items resourceへのPOSTとみなす。 --- a/app/controllers/order_items_controller.rb Mon Mar 10 10:39:23 2008 +0900 +++ b/app/controllers/order_items_controller.rb Mon Mar 10 11:04:49 2008 +0900 @@ -91,6 +91,7 @@ class OrderItemsController < Application @order = Order.find(session[:order_id]) else @order = Order.create + session[:order_id] = @order.id end end end --- a/app/controllers/orders_controller.rb Mon Mar 10 10:39:23 2008 +0900 +++ b/app/controllers/orders_controller.rb Mon Mar 10 11:04:49 2008 +0900 @@ -80,6 +80,7 @@ class OrdersController < ApplicationCont @order = Order.find(session[:order_id]) else @order = Order.create + session[:order_id] = @order.id end end end --- a/app/views/products/show.html.erb Mon Mar 10 10:39:23 2008 +0900 +++ b/app/views/products/show.html.erb Mon Mar 10 11:04:49 2008 +0900 @@ -9,5 +9,6 @@

+<%= link_to 'Add to Cart', order_items_path(:order_item => { :product_id => @product.id, :quantity => 1 }), :method => :post %> | <%= link_to 'Edit', edit_product_path(@product) %> | <%= link_to 'Back', products_path %>