Your Pragmatic Cart
- 1 × Pragmatic Project Automation
8.4 Iteration C3: Handling Errors 8.2 Iteration C1: Creating a Cart
edit app/models/cart_item.rb
class CartItem
attr_reader :product, :quantity
def initialize(product)
@product = product
@quantity = 1
end
def increment_quantity
@quantity += 1
end
def title
@product.title
end
def price
@product.price * @quantity
end
end
edit app/models/cart.rb
def add_product(product)
current_item = @items.find {|item| item.product == product}
if current_item
current_item.increment_quantity
else
@items << CartItem.new(product)
end
end
edit app/views/store/add_to_cart.html.erb
<h2>Your Pragmatic Cart</h2>
<ul>
<% for item in @cart.items %>
<li><%= item.quantity %> × <%= item.title %></li>
<% end %>
</ul>
get /store/add_to_cart/2
undefined method `product' for #<Product:0x8fd9050>
Rails.root: /home/rubys/git/awdwr/work-193/depot
app/models/cart.rb:10:in `block in add_product'
app/models/cart.rb:10:in `each'
app/models/cart.rb:10:in `find'
app/models/cart.rb:10:in `add_product'
app/controllers/store_controller.rb:11:in `add_to_cart'
/home/rubys/git/rails/activemodel/lib/active_model/attribute_methods.rb:364:in `method_missing'
/home/rubys/git/rails/activerecord/lib/active_record/attribute_methods.rb:46:in `method_missing'
/home/rubys/git/rails/activerecord/lib/active_record/attribute_methods.rb:44:in `method_missing'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:148:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rendering.rb:11:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:430:in `_run__423351281__process_action__453425883__callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:404:in `_run_process_action_callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:93:in `run_callbacks'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `block in instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `instrument'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rescue.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:117:in `process'
/home/rubys/git/rails/actionpack/lib/abstract_controller/rendering.rb:40:in `process'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:133:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:173:in `block in action'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:89:in `block in recognize'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:66:in `optimized_each'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:88:in `recognize'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:139:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:492:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/best_standards_support.rb:8:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/flash.rb:177:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/cookies.rb:268:in `call'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:32:in `block in call'
/home/rubys/git/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:12:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:31:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:410:in `_run_call_callbacks'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:48:in `call'
/home/rubys/git/rails/railties/lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
/home/rubys/git/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/static.rb:30:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:168:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:77:in `method_missing'
/home/rubys/git/rails/railties/lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
/home/rubys/git/rails/activemodel/lib/active_model/attribute_methods.rb:364:in `method_missing'
/home/rubys/git/rails/activerecord/lib/active_record/attribute_methods.rb:46:in `method_missing'
/home/rubys/git/rails/activerecord/lib/active_record/attribute_methods.rb:44:in `method_missing'
app/models/cart.rb:10:in `block in add_product'
app/models/cart.rb:10:in `each'
app/models/cart.rb:10:in `find'
app/models/cart.rb:10:in `add_product'
app/controllers/store_controller.rb:11:in `add_to_cart'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:148:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rendering.rb:11:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:430:in `_run__423351281__process_action__453425883__callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:404:in `_run_process_action_callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:93:in `run_callbacks'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `block in instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `instrument'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rescue.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:117:in `process'
/home/rubys/git/rails/actionpack/lib/abstract_controller/rendering.rb:40:in `process'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:133:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:173:in `block in action'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:89:in `block in recognize'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:66:in `optimized_each'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:88:in `recognize'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:139:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:492:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/best_standards_support.rb:8:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/flash.rb:177:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/cookies.rb:268:in `call'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:32:in `block in call'
/home/rubys/git/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:12:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:31:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:410:in `_run_call_callbacks'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:48:in `call'
/home/rubys/git/rails/railties/lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
/home/rubys/git/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/static.rb:30:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:168:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:77:in `method_missing'
/home/rubys/git/rails/railties/lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Parameters:
{"id"=>"2"}
cart: #<Cart:0x8fd90c8 @items=[#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:923fed4,'0.2995E2',8(8)>>, #<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:923f4c0,'0.285E2',8(8)>>]>
GATEWAY_INTERFACE: "CGI/1.1" HTTP_ACCEPT: "text/html" HTTP_COOKIE: "_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly" HTTP_HOST: "localhost:3000" HTTP_USER_AGENT: "Ruby" HTTP_VERSION: "HTTP/1.1" PATH_INFO: "/store/add_to_cart/2" QUERY_STRING: "" REMOTE_ADDR: "127.0.0.1" REMOTE_HOST: "localhost" REQUEST_METHOD: "GET" REQUEST_PATH: "/" REQUEST_URI: "http://localhost:3000/store/add_to_cart/2" SCRIPT_NAME: "" SERVER_NAME: "localhost" SERVER_PORT: "3000" SERVER_PROTOCOL: "HTTP/1.1" SERVER_SOFTWARE: "WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)" action_controller.instance: #<StoreController:0x9049e18 @action_has_layout=true, @view_context_class=nil, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_response=#<ActionDispatch::Response:0x9049cb0 @writer=#<Proc:0x9049c4c@/home/rubys/git/rails/actionpack/lib/action_dispatch/http/response.rb:44 (lambda)>, @block=nil, @length=0, @header={}, @status=200, @body=[], @cookie=[], @sending_file=false, @blank=false, @cache_control={}, @etag=nil, @request=#<ActionDispatch::Request:0x9049cc4 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/store/add_to_cart/2", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/store/add_to_cart/2", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)", "HTTP_ACCEPT"=>"text/html", "HTTP_USER_AGENT"=>"Ruby", "HTTP_COOKIE"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "HTTP_HOST"=>"localhost:3000", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x8f5dba8>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/", "action_dispatch.parameter_filter"=>[:password], "action_dispatch.secret_token"=>"70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"cart"=>#<Cart:0x8fd90c8 @items=[#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:9245cd0,'0.2995E2',8(8)>>, #<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:9245190,'0.285E2',8(8)>>]>}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"}, "rack.request.cookie_string"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "rack.request.cookie_hash"=>{"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil}, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 1, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DFB...", created_at: "2010-08-08 16:21:59", updated_at: "2010-08-08 16:21:59">, "action_dispatch.request.path_parameters"=>{:controller=>"store", :action=>"add_to_cart", :id=>"2"}, "action_controller.instance"=>#<StoreController:0x9049e18 ...>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"}, "action_dispatch.request.accepts"=>[text/html], "action_dispatch.request.formats"=>[text/html]}, @fullpath="/store/add_to_cart/2", @request_method="GET", @filtered_parameters={"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"}, @method="GET">>, @_request=#<ActionDispatch::Request:0x9049cc4 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/store/add_to_cart/2", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/store/add_to_cart/2", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)", "HTTP_ACCEPT"=>"text/html", "HTTP_USER_AGENT"=>"Ruby", "HTTP_COOKIE"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "HTTP_HOST"=>"localhost:3000", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x8f5dba8>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/", "action_dispatch.parameter_filter"=>[:password], "action_dispatch.secret_token"=>"70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"cart"=>#<Cart:0x8fd90c8 @items=[#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:924ffb4,'0.2995E2',8(8)>>, #<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:924f5b4,'0.285E2',8(8)>>]>}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"}, "rack.request.cookie_string"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "rack.request.cookie_hash"=>{"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil}, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 1, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DFB...", created_at: "2010-08-08 16:21:59", updated_at: "2010-08-08 16:21:59">, "action_dispatch.request.path_parameters"=>{:controller=>"store", :action=>"add_to_cart", :id=>"2"}, "action_controller.instance"=>#<StoreController:0x9049e18 ...>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"}, "action_dispatch.request.accepts"=>[text/html], "action_dispatch.request.formats"=>[text/html]}, @fullpath="/store/add_to_cart/2", @request_method="GET", @filtered_parameters={"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"}, @method="GET">, @_env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/store/add_to_cart/2", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/store/add_to_cart/2", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)", "HTTP_ACCEPT"=>"text/html", "HTTP_USER_AGENT"=>"Ruby", "HTTP_COOKIE"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "HTTP_HOST"=>"localhost:3000", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x8f5dba8>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/", "action_dispatch.parameter_filter"=>[:password], "action_dispatch.secret_token"=>"70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"cart"=>#<Cart:0x8fd90c8 @items=[#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:9264ae0,'0.2995E2',8(8)>>, #<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:9263c08,'0.285E2',8(8)>>]>}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"}, "rack.request.cookie_string"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "rack.request.cookie_hash"=>{"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil}, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 1, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DFB...", created_at: "2010-08-08 16:21:59", updated_at: "2010-08-08 16:21:59">, "action_dispatch.request.path_parameters"=>{:controller=>"store", :action=>"add_to_cart", :id=>"2"}, "action_controller.instance"=>#<StoreController:0x9049e18 ...>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"}, "action_dispatch.request.accepts"=>[text/html], "action_dispatch.request.formats"=>[text/html]}, @lookup_context=#<ActionView::LookupContext:0x9049634 @details_key=nil, @details={:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]}, @skip_default_locale=false, @frozen_formats=false, @view_paths=[/home/rubys/git/awdwr/work-193/depot/app/views]>, @_action_name="add_to_cart", @_response_body=nil, @config={}, @_params={"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"}, @cart=#<Cart:0x8fd90c8 @items=[#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:9261d04,'0.2995E2',8(8)>>, #<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:926141c,'0.285E2',8(8)>>]>> action_dispatch.parameter_filter: [:password] action_dispatch.remote_ip: 127.0.0.1 action_dispatch.request.accepts: [text/html] action_dispatch.request.content_type: nil action_dispatch.request.formats: [text/html] action_dispatch.request.parameters: {"controller"=>"store", "action"=>"add_to_cart", "id"=>"2"} action_dispatch.request.path_parameters: {:controller=>"store", :action=>"add_to_cart", :id=>"2"} action_dispatch.request.query_parameters: {} action_dispatch.request.request_parameters: {} action_dispatch.secret_token: "70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092" rack.errors: #<IO:<STDERR>> rack.input: #<StringIO:0x8f5dba8> rack.multiprocess: false rack.multithread: false rack.request.cookie_hash: {"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil} rack.request.cookie_string: "_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly" rack.request.query_hash: {} rack.request.query_string: "" rack.run_once: false rack.session: {"cart"=>#<Cart:0x8fd90c8 @items=[#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:927339c,'0.2995E2',8(8)>>, #<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:9272b90,'0.285E2',8(8)>>]>} rack.session.options: {:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"} rack.session.record: #<ActiveRecord::SessionStore::Session id: 1, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DFB...", created_at: "2010-08-08 16:21:59", updated_at: "2010-08-08 16:21:59"> rack.url_scheme: "http" rack.version: [1, 1]
Headers:
None
rake db:sessions:clear
/home/rubys/.rvm/gems/ruby-1.9.3-r28929/gems/bundler-1.0.0.rc.3/lib/bundler.rb:183: Use RbConfig instead of obsolete and deprecated Config.
(in /home/rubys/git/awdwr/work-193/depot)
get /store/add_to_cart/2
get /store/add_to_cart/2
get /store/add_to_cart/3
get /store/add_to_cart/wibble
Couldn't find Product with ID=wibble
Rails.root: /home/rubys/git/awdwr/work-193/depot
app/controllers/store_controller.rb:9:in `add_to_cart'
/home/rubys/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:296:in `find_one'
/home/rubys/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:281:in `find_with_ids'
/home/rubys/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:107:in `find'
/home/rubys/git/rails/activerecord/lib/active_record/base.rb:439:in `find'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:148:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rendering.rb:11:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:430:in `_run__423351281__process_action__453425883__callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:404:in `_run_process_action_callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:93:in `run_callbacks'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `block in instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `instrument'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rescue.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:117:in `process'
/home/rubys/git/rails/actionpack/lib/abstract_controller/rendering.rb:40:in `process'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:133:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:173:in `block in action'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:89:in `block in recognize'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:66:in `optimized_each'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:88:in `recognize'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:139:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:492:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/best_standards_support.rb:8:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/flash.rb:177:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/cookies.rb:268:in `call'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:32:in `block in call'
/home/rubys/git/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:12:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:31:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:410:in `_run_call_callbacks'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:48:in `call'
/home/rubys/git/rails/railties/lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
/home/rubys/git/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/static.rb:30:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:168:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:77:in `method_missing'
/home/rubys/git/rails/railties/lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
/home/rubys/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:296:in `find_one'
/home/rubys/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:281:in `find_with_ids'
/home/rubys/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:107:in `find'
/home/rubys/git/rails/activerecord/lib/active_record/base.rb:439:in `find'
app/controllers/store_controller.rb:9:in `add_to_cart'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:148:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rendering.rb:11:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:430:in `_run__423351281__process_action__453425883__callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:404:in `_run_process_action_callbacks'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:93:in `run_callbacks'
/home/rubys/git/rails/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `block in instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/rubys/git/rails/activesupport/lib/active_support/notifications.rb:52:in `instrument'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rescue.rb:17:in `process_action'
/home/rubys/git/rails/actionpack/lib/abstract_controller/base.rb:117:in `process'
/home/rubys/git/rails/actionpack/lib/abstract_controller/rendering.rb:40:in `process'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:133:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_controller/metal.rb:173:in `block in action'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:89:in `block in recognize'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:66:in `optimized_each'
rack-mount (0.6.9) lib/rack/mount/code_generation.rb:88:in `recognize'
rack-mount (0.6.9) lib/rack/mount/route_set.rb:139:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/routing/route_set.rb:492:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/best_standards_support.rb:8:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/flash.rb:177:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/cookies.rb:268:in `call'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:32:in `block in call'
/home/rubys/git/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:12:in `cache'
/home/rubys/git/rails/activerecord/lib/active_record/query_cache.rb:31:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
/home/rubys/git/rails/activesupport/lib/active_support/callbacks.rb:410:in `_run_call_callbacks'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:48:in `call'
/home/rubys/git/rails/railties/lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
/home/rubys/git/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
/home/rubys/git/rails/actionpack/lib/action_dispatch/middleware/static.rb:30:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:168:in `call'
/home/rubys/git/rails/railties/lib/rails/application.rb:77:in `method_missing'
/home/rubys/git/rails/railties/lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/rubys/.rvm/rubies/ruby-1.9.3-r28929/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Parameters:
{"id"=>"wibble"}
cart: #<Cart:0x8a6fccc @items=[#<CartItem:0x8a6fc68 @product=#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fa3fb8,'0.2995E2',8(8)>>, @quantity=2>, #<CartItem:0x8a6f86c @product=#<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fb6424,'0.285E2',8(8)>>, @quantity=1>]>
GATEWAY_INTERFACE: "CGI/1.1" HTTP_ACCEPT: "text/html" HTTP_COOKIE: "_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly" HTTP_HOST: "localhost:3000" HTTP_USER_AGENT: "Ruby" HTTP_VERSION: "HTTP/1.1" PATH_INFO: "/store/add_to_cart/wibble" QUERY_STRING: "" REMOTE_ADDR: "127.0.0.1" REMOTE_HOST: "localhost" REQUEST_METHOD: "GET" REQUEST_PATH: "/" REQUEST_URI: "http://localhost:3000/store/add_to_cart/wibble" SCRIPT_NAME: "" SERVER_NAME: "localhost" SERVER_PORT: "3000" SERVER_PROTOCOL: "HTTP/1.1" SERVER_SOFTWARE: "WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)" action_controller.instance: #<StoreController:0x8c4e4bc @action_has_layout=true, @view_context_class=nil, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_response=#<ActionDispatch::Response:0x8c4e05c @writer=#<Proc:0x8c4ddb4@/home/rubys/git/rails/actionpack/lib/action_dispatch/http/response.rb:44 (lambda)>, @block=nil, @length=0, @header={}, @status=200, @body=[], @cookie=[], @sending_file=false, @blank=false, @cache_control={}, @etag=nil, @request=#<ActionDispatch::Request:0x8c4e0d4 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/store/add_to_cart/wibble", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/store/add_to_cart/wibble", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)", "HTTP_ACCEPT"=>"text/html", "HTTP_USER_AGENT"=>"Ruby", "HTTP_COOKIE"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "HTTP_HOST"=>"localhost:3000", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x85af430>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/", "action_dispatch.parameter_filter"=>[:password], "action_dispatch.secret_token"=>"70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"cart"=>#<Cart:0x8a6fccc @items=[#<CartItem:0x8a6fc68 @product=#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fb9e94,'0.2995E2',8(8)>>, @quantity=2>, #<CartItem:0x8a6f86c @product=#<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fb9228,'0.285E2',8(8)>>, @quantity=1>]>}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"}, "rack.request.cookie_string"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "rack.request.cookie_hash"=>{"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil}, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 2, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DUN...", created_at: "2010-08-08 16:22:02", updated_at: "2010-08-08 16:22:03">, "action_dispatch.request.path_parameters"=>{:controller=>"store", :action=>"add_to_cart", :id=>"wibble"}, "action_controller.instance"=>#<StoreController:0x8c4e4bc ...>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"}, "action_dispatch.request.accepts"=>[text/html], "action_dispatch.request.formats"=>[text/html]}, @fullpath="/store/add_to_cart/wibble", @request_method="GET", @filtered_parameters={"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"}, @method="GET">>, @_request=#<ActionDispatch::Request:0x8c4e0d4 @env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/store/add_to_cart/wibble", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/store/add_to_cart/wibble", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)", "HTTP_ACCEPT"=>"text/html", "HTTP_USER_AGENT"=>"Ruby", "HTTP_COOKIE"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "HTTP_HOST"=>"localhost:3000", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x85af430>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/", "action_dispatch.parameter_filter"=>[:password], "action_dispatch.secret_token"=>"70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"cart"=>#<Cart:0x8a6fccc @items=[#<CartItem:0x8a6fc68 @product=#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fc8854,'0.2995E2',8(8)>>, @quantity=2>, #<CartItem:0x8a6f86c @product=#<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fc7ecc,'0.285E2',8(8)>>, @quantity=1>]>}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"}, "rack.request.cookie_string"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "rack.request.cookie_hash"=>{"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil}, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 2, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DUN...", created_at: "2010-08-08 16:22:02", updated_at: "2010-08-08 16:22:03">, "action_dispatch.request.path_parameters"=>{:controller=>"store", :action=>"add_to_cart", :id=>"wibble"}, "action_controller.instance"=>#<StoreController:0x8c4e4bc ...>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"}, "action_dispatch.request.accepts"=>[text/html], "action_dispatch.request.formats"=>[text/html]}, @fullpath="/store/add_to_cart/wibble", @request_method="GET", @filtered_parameters={"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"}, @method="GET">, @_env={"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/store/add_to_cart/wibble", "QUERY_STRING"=>"", "REMOTE_ADDR"=>"127.0.0.1", "REMOTE_HOST"=>"localhost", "REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"http://localhost:3000/store/add_to_cart/wibble", "SCRIPT_NAME"=>"", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"3000", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.9.3/2010-08-09)", "HTTP_ACCEPT"=>"text/html", "HTTP_USER_AGENT"=>"Ruby", "HTTP_COOKIE"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "HTTP_HOST"=>"localhost:3000", "rack.version"=>[1, 1], "rack.input"=>#<StringIO:0x85af430>, "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, "rack.url_scheme"=>"http", "HTTP_VERSION"=>"HTTP/1.1", "REQUEST_PATH"=>"/", "action_dispatch.parameter_filter"=>[:password], "action_dispatch.secret_token"=>"70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092", "action_dispatch.remote_ip"=>127.0.0.1, "rack.session"=>{"cart"=>#<Cart:0x8a6fccc @items=[#<CartItem:0x8a6fc68 @product=#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fd6b0c,'0.2995E2',8(8)>>, @quantity=2>, #<CartItem:0x8a6f86c @product=#<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fd61fc,'0.285E2',8(8)>>, @quantity=1>]>}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"}, "rack.request.cookie_string"=>"_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly", "rack.request.cookie_hash"=>{"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil}, "rack.session.record"=>#<ActiveRecord::SessionStore::Session id: 2, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DUN...", created_at: "2010-08-08 16:22:02", updated_at: "2010-08-08 16:22:03">, "action_dispatch.request.path_parameters"=>{:controller=>"store", :action=>"add_to_cart", :id=>"wibble"}, "action_controller.instance"=>#<StoreController:0x8c4e4bc ...>, "action_dispatch.request.content_type"=>nil, "action_dispatch.request.request_parameters"=>{}, "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.parameters"=>{"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"}, "action_dispatch.request.accepts"=>[text/html], "action_dispatch.request.formats"=>[text/html]}, @lookup_context=#<ActionView::LookupContext:0x8c65414 @details_key=nil, @details={:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]}, @skip_default_locale=false, @frozen_formats=false, @view_paths=[/home/rubys/git/awdwr/work-193/depot/app/views]>, @_action_name="add_to_cart", @_response_body=nil, @config={}, @_params={"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"}> action_dispatch.parameter_filter: [:password] action_dispatch.remote_ip: 127.0.0.1 action_dispatch.request.accepts: [text/html] action_dispatch.request.content_type: nil action_dispatch.request.formats: [text/html] action_dispatch.request.parameters: {"controller"=>"store", "action"=>"add_to_cart", "id"=>"wibble"} action_dispatch.request.path_parameters: {:controller=>"store", :action=>"add_to_cart", :id=>"wibble"} action_dispatch.request.query_parameters: {} action_dispatch.request.request_parameters: {} action_dispatch.secret_token: "70af2f4a808fc9dcb674a466e5ac40287cc2e713d3b2a467ecea1a17c8728cb7b794940d6cd7b08d9b2666235e72da3de9439dab4818d3b5f3014032b1ad6092" rack.errors: #<IO:<STDERR>> rack.input: #<StringIO:0x85af430> rack.multiprocess: false rack.multithread: false rack.request.cookie_hash: {"_session_id"=>"e887829ba71c0003b81ab90e827c4c30", "path"=>"/", "HttpOnly"=>nil} rack.request.cookie_string: "_session_id=e887829ba71c0003b81ab90e827c4c30; path=/; HttpOnly" rack.request.query_hash: {} rack.request.query_string: "" rack.run_once: false rack.session: {"cart"=>#<Cart:0x8a6fccc @items=[#<CartItem:0x8a6fc68 @product=#<Product id: 2, title: "Pragmatic Project Automation", description: "<p>\n <em>Pragmatic Project Automation</em> sh...", image_url: "/images/auto.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fd3ab0,'0.2995E2',8(8)>>, @quantity=2>, #<CartItem:0x8a6f86c @product=#<Product id: 3, title: "Pragmatic Version Control", description: "<p>\n This book is a recipe-based approach t...", image_url: "/images/svn.jpg", created_at: "2010-08-08 16:21:46", updated_at: "2010-08-08 16:21:46", price: #<BigDecimal:8fdb8f0,'0.285E2',8(8)>>, @quantity=1>]>} rack.session.options: {:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :id=>"e887829ba71c0003b81ab90e827c4c30"} rack.session.record: #<ActiveRecord::SessionStore::Session id: 2, session_id: "e887829ba71c0003b81ab90e827c4c30", data: "BAh7BkkiCWNhcnQGOgZFRm86CUNhcnQGOgtAaXRlbXNbB286DUN...", created_at: "2010-08-08 16:22:02", updated_at: "2010-08-08 16:22:03"> rack.url_scheme: "http" rack.version: [1, 1]
Headers:
None
8.4 Iteration C3: Handling Errors 8.2 Iteration C1: Creating a Cart