Your Pragmatic Cart
- 1 × Pragmatic Project Automation
8.3 Iteration C2: Creating a Smarter Cart 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 %> × <%=h item.title %></li>
<% end %>
</ul>
get /store/add_to_cart/2
undefined method `product' for #<Product:0xb793508c>
RAILS_ROOT: /home/rubys/git/awdwr/work-235/depot
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:264:in `method_missing'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `add_product'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `find'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `each'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `find'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `add_product'
/home/rubys/git/awdwr/work-235/depot/app/controllers/store_controller.rb:11:in `add_to_cart'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `perform_action_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/rack/lib/rack/head.rb:9:in `call'
/home/rubys/git/rack/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:47:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `each'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/git/rack/lib/rack/content_length.rb:13:in `call'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:264:in `method_missing'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `add_product'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/dependencies.rb:380:in `find'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `each'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `find'
/home/rubys/git/awdwr/work-235/depot/app/models/cart.rb:10:in `add_product'
/home/rubys/git/awdwr/work-235/depot/app/controllers/store_controller.rb:11:in `add_to_cart'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `perform_action_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/rack/lib/rack/head.rb:9:in `call'
/home/rubys/git/rack/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:47:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `each'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/git/rack/lib/rack/content_length.rb:13:in `call'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
Parameters:
{"id"=>"2"}
---
Headers:
{"Content-Type"=>"", "Cache-Control"=>"no-cache"}
rake db:sessions:clear
(in /home/rubys/git/awdwr/work-235/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-235/depot
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/base.rb:1609:in `find_one'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/base.rb:1592:in `find_from_ids'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/base.rb:616:in `find'
/home/rubys/git/awdwr/work-235/depot/app/controllers/store_controller.rb:9:in `add_to_cart'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `perform_action_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/rack/lib/rack/head.rb:9:in `call'
/home/rubys/git/rack/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:47:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `each'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/git/rack/lib/rack/content_length.rb:13:in `call'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/base.rb:1609:in `find_one'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/base.rb:1592:in `find_from_ids'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/base.rb:616:in `find'
/home/rubys/git/awdwr/work-235/depot/app/controllers/store_controller.rb:9:in `add_to_cart'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1340:in `perform_action_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/rack/lib/rack/head.rb:9:in `call'
/home/rubys/git/rack/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/git/rack/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:47:in `call'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `each'
/home/rubys/git/rack/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/git/rack/lib/rack/content_length.rb:13:in `call'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/git/rack/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/work-235/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
Parameters:
{"id"=>"wibble"}
---
Headers:
{"Content-Type"=>"", "Cache-Control"=>"no-cache"}
8.3 Iteration C2: Creating a Smarter Cart 8.2 Iteration C1: Creating a Cart