End chapter 8
authorNeil Smith <neil.git@njae.me.uk>
Wed, 4 Feb 2009 21:44:13 +0000 (21:44 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Wed, 4 Feb 2009 21:44:13 +0000 (21:44 +0000)
app/controllers/store_controller.rb [new file with mode: 0644]
app/helpers/store_helper.rb [new file with mode: 0644]
app/models/product.rb
app/views/layouts/store.html.erb [new file with mode: 0644]
app/views/store/index.html.erb [new file with mode: 0644]
log/development.log
public/stylesheets/depot.css
test/functional/store_controller_test.rb [new file with mode: 0644]

diff --git a/app/controllers/store_controller.rb b/app/controllers/store_controller.rb
new file mode 100644 (file)
index 0000000..9973d07
--- /dev/null
@@ -0,0 +1,6 @@
+class StoreController < ApplicationController
+  def index
+    @products = Product.find_products_for_sale
+  end
+
+end
diff --git a/app/helpers/store_helper.rb b/app/helpers/store_helper.rb
new file mode 100644 (file)
index 0000000..9263619
--- /dev/null
@@ -0,0 +1,2 @@
+module StoreHelper
+end
index 4cd770b8408e024060066222912e8afdb473d4e7..9cc9488c6030d3a2ba776359b759115f1df07e70 100644 (file)
@@ -7,6 +7,12 @@ class Product < ActiveRecord::Base
                       :with    => %r{\.(gif|jpg|png)$}i,
                       :message => "must be a URL for GIF, JPG, or PNG image."
   
+  def self.find_products_for_sale
+    find(:all, 
+      :conditions => "date_available <= now()",
+      :order => :title)
+  end
+  
 protected
   def price_must_be_at_least_a_penny
     errors.add(:price, 'should be at least 0.01') if price.nil? || price < 0.01
diff --git a/app/views/layouts/store.html.erb b/app/views/layouts/store.html.erb
new file mode 100644 (file)
index 0000000..7bd5325
--- /dev/null
@@ -0,0 +1,26 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <title>Neil's Whimsical Online Store</title>
+    <%= stylesheet_link_tag "depot" , :media => "all" %>
+  </head>
+  <body id="store">
+    <div id="banner">
+      <%= image_tag("logo.png" ) %>
+      <%= @page_title || "Neil's Whimisical Store" %>
+    </div>
+    <div id="columns">
+      <div id="side">
+        <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">
+        <%= yield :layout %>
+      </div>
+    </div>
+  </body>
+</html>
\ No newline at end of file
diff --git a/app/views/store/index.html.erb b/app/views/store/index.html.erb
new file mode 100644 (file)
index 0000000..1ed17dd
--- /dev/null
@@ -0,0 +1,13 @@
+<h1>Neil's Whimsical Store Catalogue</h1>
+
+<% for product in @products -%>
+  <div class="entry">
+    <%= image_tag(product.image_url) %>
+    <h3><%=h product.title %></h3>
+    <%= product.description %>
+    <div class="price-line">
+      <span class="price"><%= number_to_currency product.price, :unit => "&pound;" %></span>
+      <%= button_to "Add to cart" %>
+    </div>
+  </div>
+<% end %>
index df17da6f0d22a636fffeaaf1c3b68ab82daa9ff0..d4301bcbe69836e6068869531a38b1ccd5ca1e15 100644 (file)
@@ -1212,3 +1212,392 @@ Rendering template within layouts/products
 Rendering products/index
   \e[4;36;1mProduct Columns (1.1ms)\e[0m   \e[0;1mSHOW FIELDS FROM `products`\e[0m
 Completed in 53ms (View: 40, DB: 2) | 200 OK [http://localhost/products]
+
+
+Processing ProductsController#index (for 127.0.0.1 at 2009-02-03 10:08:16) [GET]
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET NAMES 'utf8'\e[0m
+  \e[4;36;1mSQL (0.3ms)\e[0m   \e[0;1mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;35;1mProduct Load (0.3ms)\e[0m   \e[0mSELECT * FROM `products` \e[0m
+Rendering template within layouts/products
+Rendering products/index
+  \e[4;36;1mProduct Columns (2.4ms)\e[0m   \e[0;1mSHOW FIELDS FROM `products`\e[0m
+Completed in 118ms (View: 80, DB: 3) | 200 OK [http://localhost/products]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2009-02-03 10:08:16) [GET]
+
+
+ActionController::RoutingError (No route matches "/store" with {:method=>:get}):
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:103:in `handle_dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:74:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.rb:66
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    script/server:3
+
+Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (not_found)
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2009-02-04 13:58:28) [GET]
+
+
+ActionController::RoutingError (No route matches "/store" with {:method=>:get}):
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:103:in `handle_dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:74:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.rb:66
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    script/server:3
+
+Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (not_found)
+
+
+Processing ProductsController#index (for 127.0.0.1 at 2009-02-04 13:59:23) [GET]
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET NAMES 'utf8'\e[0m
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;35;1mProduct Load (0.3ms)\e[0m   \e[0mSELECT * FROM `products` \e[0m
+Rendering template within layouts/products
+Rendering products/index
+  \e[4;36;1mProduct Columns (4.4ms)\e[0m   \e[0;1mSHOW FIELDS FROM `products`\e[0m
+Completed in 189ms (View: 154, DB: 5) | 200 OK [http://localhost/products]
+
+
+Processing ProductsController#show (for 127.0.0.1 at 2009-02-04 13:59:27) [GET]
+  Parameters: {"id"=>"1"}
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET NAMES 'utf8'\e[0m
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;35;1mProduct Columns (1.5ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+  \e[4;36;1mProduct Load (0.5ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (`products`.`id` = 1) \e[0m
+Rendering template within layouts/products
+Rendering products/show
+Completed in 49ms (View: 30, DB: 2) | 200 OK [http://localhost/products/1]
+
+
+Processing ProductsController#index (for 127.0.0.1 at 2009-02-04 13:59:29) [GET]
+  \e[4;35;1mSQL (0.1ms)\e[0m   \e[0mSET NAMES 'utf8'\e[0m
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;35;1mProduct Load (0.3ms)\e[0m   \e[0mSELECT * FROM `products` \e[0m
+Rendering template within layouts/products
+Rendering products/index
+  \e[4;36;1mProduct Columns (2.0ms)\e[0m   \e[0;1mSHOW FIELDS FROM `products`\e[0m
+Completed in 70ms (View: 49, DB: 2) | 200 OK [http://localhost/products]
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2009-02-04 13:59:32) [GET]
+
+
+ActionController::RoutingError (No route matches "/store" with {:method=>:get}):
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:103:in `handle_dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:74:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.rb:66
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    script/server:3
+
+Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (not_found)
+
+
+Processing ApplicationController#index (for 127.0.0.1 at 2009-02-04 13:59:36) [GET]
+
+
+ActionController::RoutingError (No route matches "/store" with {:method=>:get}):
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:103:in `handle_dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:74:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.rb:66
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    script/server:3
+
+Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (not_found)
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 14:01:27) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+Rendering store/index
+Completed in 7ms (View: 3, DB: 0) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 14:12:04) [GET]
+  \e[4;36;1mSQL (1.8ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mSQL (14.7ms)\e[0m   \e[0;1mSHOW TABLES\e[0m
+  \e[4;35;1mProduct Columns (3.8ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+
+
+NameError (undefined local variable or method `conditions' for #<Class:0xb70fec24>):
+    /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:in `method_missing'
+    /app/models/product.rb:12:in `find_products_for_sale'
+    /app/controllers/store_controller.rb:3:in `index'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in `send'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in `perform_action_without_filters'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in `call_filters'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
+    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:in `perform_action_without_caching'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
+    /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
+    /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in `cache'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in `send'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in `process_without_filters'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in `process'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:in `process'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in `handle_request'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
+    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:103:in `handle_dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:74:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
+    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
+    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
+    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
+    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
+    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in `dispatch'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.rb:66
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
+    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
+    /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
+    /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
+    script/server:3
+
+Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/_trace (172.9ms)
+Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/_request_and_response (2.9ms)
+Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (internal_server_error)
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 14:12:32) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (141.7ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering store/index
+  \e[4;35;1mProduct Columns (2.0ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 172ms (View: 18, DB: 142) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 14:12:53) [GET]
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.1ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.6ms)\e[0m   \e[0;1mSELECT * FROM `products` ORDER BY title\e[0m
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.3ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 27ms (View: 15, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 14:13:05) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.9ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.9ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 39ms (View: 19, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 14:15:08) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.8ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering store/index
+  \e[4;35;1mProduct Columns (2.0ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 50ms (View: 29, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:32:09) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.3ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.9ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (2.2ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 39ms (View: 27, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:33:51) [GET]
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.6ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.2ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 39ms (View: 25, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:35:16) [GET]
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.9ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.9ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 49ms (View: 31, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:38:26) [GET]
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.8ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (2.1ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 57ms (View: 38, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:40:47) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.2ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.9ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (2.1ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 51ms (View: 33, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:41:01) [GET]
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.1ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.6ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.4ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 40ms (View: 26, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:41:26) [GET]
+  \e[4;36;1mSQL (0.2ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.1ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.6ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.1ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 38ms (View: 27, DB: 1) | 200 OK [http://localhost/store]
+
+
+Processing StoreController#index (for 127.0.0.1 at 2009-02-04 21:41:32) [POST]
+  Parameters: {"authenticity_token"=>"e5d513dc6072444247eccfd6ee064972eb3383d9"}
+  \e[4;36;1mSQL (0.1ms)\e[0m   \e[0;1mSET NAMES 'utf8'\e[0m
+  \e[4;35;1mSQL (0.1ms)\e[0m   \e[0mSET SQL_AUTO_IS_NULL=0\e[0m
+  \e[4;36;1mProduct Load (0.6ms)\e[0m   \e[0;1mSELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title\e[0m
+Rendering template within layouts/store
+Rendering store/index
+  \e[4;35;1mProduct Columns (1.1ms)\e[0m   \e[0mSHOW FIELDS FROM `products`\e[0m
+Completed in 39ms (View: 28, DB: 1) | 200 OK [http://localhost/store]
index 62a2d6708382c442361b52a03a31e6cf3552ef12..d3b1341d7468c7483c003daf64562ea9bdb31290 100644 (file)
@@ -58,6 +58,47 @@ h1 {
   background:   #f8b0f8;
 }
 
+
+/* Styles for main page */
+#banner {
+  background: #9c9 ;
+  padding-top: 10px;
+  padding-bottom: 10px;
+  border-bottom: 2px solid;
+  font: small-caps 40px/40px "Times New Roman", serif;
+  color: #282 ;
+  text-align: center;
+}
+
+#banner img {
+  float: left;
+}
+
+#columns {
+  background: #141 ;
+}
+
+#main {
+  margin-left: 13em;
+  padding-top: 4ex;
+  padding-left: 2em;
+  background: white;
+}
+
+#side {
+  float: left;
+  padding-top: 1em;
+  padding-left: 1em;
+  padding-bottom: 1em;
+  width: 12em;
+  background: #141 ;
+}
+
+#side a {
+  color: #bfb ;
+  font-size: small;
+}
+
 /* An entry in the store catalog */
 
 #store  .entry {
@@ -102,6 +143,11 @@ h1 {
   margin-right: 2em;
 }
 
+#store .entry form, #store .entry form div {
+  display: inline;
+}
+
+
 /* The error box */
 
 .fieldWithErrors {
diff --git a/test/functional/store_controller_test.rb b/test/functional/store_controller_test.rb
new file mode 100644 (file)
index 0000000..c3de8d8
--- /dev/null
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class StoreControllerTest < ActionController::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end