From: Neil Smith Date: Wed, 4 Feb 2009 21:44:13 +0000 (+0000) Subject: End chapter 8 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=6af7ab424668bc5dce20630e1b112bc611edab63;p=depot.git End chapter 8 --- diff --git a/app/controllers/store_controller.rb b/app/controllers/store_controller.rb new file mode 100644 index 0000000..9973d07 --- /dev/null +++ b/app/controllers/store_controller.rb @@ -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 index 0000000..9263619 --- /dev/null +++ b/app/helpers/store_helper.rb @@ -0,0 +1,2 @@ +module StoreHelper +end diff --git a/app/models/product.rb b/app/models/product.rb index 4cd770b..9cc9488 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -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 index 0000000..7bd5325 --- /dev/null +++ b/app/views/layouts/store.html.erb @@ -0,0 +1,26 @@ + + + + + Neil's Whimsical Online Store + <%= stylesheet_link_tag "depot" , :media => "all" %> + + + +
+ +
+ <%= yield :layout %> +
+
+ + \ 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 index 0000000..1ed17dd --- /dev/null +++ b/app/views/store/index.html.erb @@ -0,0 +1,13 @@ +

Neil's Whimsical Store Catalogue

+ +<% for product in @products -%> +
+ <%= image_tag(product.image_url) %> +

<%=h product.title %>

+ <%= product.description %> +
+ <%= number_to_currency product.price, :unit => "£" %> + <%= button_to "Add to cart" %> +
+
+<% end %> diff --git a/log/development.log b/log/development.log index df17da6..d4301bc 100644 --- a/log/development.log +++ b/log/development.log @@ -1212,3 +1212,392 @@ Rendering template within layouts/products Rendering products/index Product Columns (1.1ms) SHOW FIELDS FROM `products` 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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.3ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.3ms) SELECT * FROM `products`  +Rendering template within layouts/products +Rendering products/index + Product Columns (2.4ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.3ms) SELECT * FROM `products`  +Rendering template within layouts/products +Rendering products/index + Product Columns (4.4ms) SHOW FIELDS FROM `products` +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"} + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Columns (1.5ms) SHOW FIELDS FROM `products` + Product Load (0.5ms) SELECT * FROM `products` WHERE (`products`.`id` = 1)  +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] + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.3ms) SELECT * FROM `products`  +Rendering template within layouts/products +Rendering products/index + Product Columns (2.0ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 +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] + SQL (1.8ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + SQL (14.7ms) SHOW TABLES + Product Columns (3.8ms) SHOW FIELDS FROM `products` + + +NameError (undefined local variable or method `conditions' for #): + /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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (141.7ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering store/index + Product Columns (2.0ms) SHOW FIELDS FROM `products` +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] + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.6ms) SELECT * FROM `products` ORDER BY title +Rendering store/index + Product Columns (1.3ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.9ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering store/index + Product Columns (1.9ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.8ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering store/index + Product Columns (2.0ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.3ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.9ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (2.2ms) SHOW FIELDS FROM `products` +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] + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.6ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (1.2ms) SHOW FIELDS FROM `products` +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] + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.9ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (1.9ms) SHOW FIELDS FROM `products` +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] + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.8ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (2.1ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.9ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (2.1ms) SHOW FIELDS FROM `products` +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] + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.6ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (1.4ms) SHOW FIELDS FROM `products` +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] + SQL (0.2ms) SET NAMES 'utf8' + SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.6ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (1.1ms) SHOW FIELDS FROM `products` +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"} + SQL (0.1ms) SET NAMES 'utf8' + SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 + Product Load (0.6ms) SELECT * FROM `products` WHERE (date_available <= now()) ORDER BY title +Rendering template within layouts/store +Rendering store/index + Product Columns (1.1ms) SHOW FIELDS FROM `products` +Completed in 39ms (View: 28, DB: 1) | 200 OK [http://localhost/store] diff --git a/public/stylesheets/depot.css b/public/stylesheets/depot.css index 62a2d67..d3b1341 100644 --- a/public/stylesheets/depot.css +++ b/public/stylesheets/depot.css @@ -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 index 0000000..c3de8d8 --- /dev/null +++ b/test/functional/store_controller_test.rb @@ -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