9.2 Iteration D2: Creating an AJAX-Based Cart 8.5 Iteration C4: Finishing the Cart
Expected at least 1 element matching ".cart-title", found 0. Traceback: /home/rubys/git/awdwr/edition3/work-187-23/vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb:307:in `assert_select' /home/rubys/git/awdwr/edition3/checkdepot.rb:149
edit app/views/store/add_to_cart.html.erb
<div class="cart-title">Your Cart</div>
<table>
<%= render(:partial => "cart_item", :collection => @cart.items) %>
<tr class="total-line">
<td colspan="2">Total</td>
<td class="total-cell"><%= number_to_currency(@cart.total_price) %></td>
</tr>
</table>
<%= button_to "Empty cart", :action => :empty_cart %>
edit app/views/store/_cart_item.html.erb
<tr>
<td><%= cart_item.quantity %>×</td>
<td><%=h cart_item.title %></td>
<td class="item-price"><%= number_to_currency(cart_item.price) %></td>
</tr>
cp app/views/store/add_to_cart.html.erb app/views/store/_cart.html.erb
edit app/views/store/_cart.html.erb
<div class="cart-title">Your Cart</div>
<table>
<%= render(:partial => "cart_item", :collection => cart.items) %>
<tr class="total-line">
<td colspan="2">Total</td>
<td class="total-cell"><%= number_to_currency(cart.total_price) %></td>
</tr>
</table>
<%= button_to "Empty cart", :action => :empty_cart %>
edit app/views/layouts/store.html.erb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Pragprog Books Online Store</title>
<%= stylesheet_link_tag "depot", :media => "all" %>
</head>
<body id="store">
<div id="banner">
<%= image_tag("logo.png") %>
<%= @page_title || "Pragmatic Bookshelf" %>
</div>
<div id="columns">
<div id="side">
<div id="cart">
<%= render(:partial => "cart", :object => @cart) %>
</div>
<a href="http://www....">Home</a><br />
<a href="http://www..../faq">Questions</a><br />
<a href="http://www..../news">News</a><br />
<a href="http://www..../contact">Contact</a><br />
</div>
<div id="main">
<% if flash[:notice] -%>
<div id="notice"><%= flash[:notice] %></div>
<% end -%>
<%= yield :layout %>
</div>
</div>
</body>
</html>
edit app/controllers/store_controller.rb
def index
@products = Product.find_products_for_sale
@cart = find_cart
end
edit public/stylesheets/depot.css
/* Styles for the cart in the sidebar */
#cart, #cart table {
font-size: smaller;
color: white;
}
#cart table {
border-top: 1px dotted #595;
border-bottom: 1px dotted #595;
margin-bottom: 10px;
}
get /store
SQLite3::SQLException: no such table: products: SELECT * FROM "products" ORDER BY title
RAILS_ROOT: /home/rubys/git/awdwr/edition3/work-187-23/depot
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
/home/rubys/git/awdwr/edition3/work-187-23/depot/app/models/product.rb:5:in `find_products_for_sale'
/home/rubys/git/awdwr/edition3/work-187-23/depot/app/controllers/store_controller.rb:4:in `index'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/head.rb:9:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:177:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:47:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `each'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/content_length.rb:13:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
script/server:3
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:172:in `execute'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:321:in `select'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:665:in `find_by_sql'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
/home/rubys/git/awdwr/edition3/work-187-23/depot/app/models/product.rb:5:in `find_products_for_sale'
/home/rubys/git/awdwr/edition3/work-187-23/depot/app/controllers/store_controller.rb:4:in `index'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/head.rb:9:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:177:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:47:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `each'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/content_length.rb:13:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
script/server:3
Parameters:
None
---
Headers:
{"Content-Type"=>"", "Cache-Control"=>"no-cache"}
edit app/controllers/store_controller.rb
def add_to_cart
product = Product.find(params[:id])
@cart = find_cart
@cart.add_product(product)
redirect_to_index
rescue ActiveRecord::RecordNotFound
logger.error("Attempt to access invalid product #{params[:id]}")
redirect_to_index("Invalid product")
end
edit app/controllers/store_controller.rb
def redirect_to_index(msg = nil)
flash[:notice] = msg if msg
redirect_to :action => 'index'
end
rm app/views/store/add_to_cart.html.erb
get /store/add_to_cart/3
Could not find table 'products'
RAILS_ROOT: /home/rubys/git/awdwr/edition3/work-187-23/depot
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1313:in `columns_hash'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1612:in `find_one'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1603:in `find_from_ids'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:620:in `find'
/home/rubys/git/awdwr/edition3/work-187-23/depot/app/controllers/store_controller.rb:13:in `add_to_cart'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/head.rb:9:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:177:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:47:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `each'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/content_length.rb:13:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
script/server:3
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `tap'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:228:in `columns'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1305:in `columns'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1313:in `columns_hash'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1612:in `find_one'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:1603:in `find_from_ids'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/base.rb:620:in `find'
/home/rubys/git/awdwr/edition3/work-187-23/depot/app/controllers/store_controller.rb:13:in `add_to_cart'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/head.rb:9:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/methodoverride.rb:24:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:177:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `synchronize'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/lock.rb:11:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:47:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `each'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/urlmap.rb:41:in `call'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/content_length.rb:13:in `call'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:48:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:95:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `each'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:92:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:23:in `start'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/webrick/server.rb:82:in `start'
/home/rubys/.rvm/gems/ruby-1.8.7-p371/gems/rack-1.1.3/lib/rack/handler/webrick.rb:14:in `run'
/home/rubys/git/awdwr/edition3/work-187-23/depot/vendor/rails/railties/lib/commands/server.rb:111
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/rubys/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
script/server:3
Parameters:
{"id"=>"3"}
---
Headers:
{"Content-Type"=>"", "Cache-Control"=>"no-cache"}
9.2 Iteration D2: Creating an AJAX-Based Cart 8.5 Iteration C4: Finishing the Cart