From cf29841dca2a4ba6313a99576d56e238b700a158 Mon Sep 17 00:00:00 2001
From: Neil Smith
<%= f.text_field :image_url %>
+ <%= f.label :price %>
+ <%= f.text_field :price %>
+
<%= f.submit "Update" %>
diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 88120ee..1db53b8 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -1,24 +1,34 @@ -Title | -Description | -Image url | -
---|
<%=h product.title %> | -<%=h product.description %> | -<%=h product.image_url %> | -<%= link_to 'Show', product %> | -<%= link_to 'Edit', edit_product_path(product) %> | -<%= link_to 'Destroy', product, :confirm => 'Are you sure?', :method => :delete %> | -
+
+ <%= f.label :price %>
+ <%= f.text_field :price %>
+
<%= f.submit "Create" %>
<% end %> diff --git a/app/views/products/show.html.erb b/app/views/products/show.html.erb index a5f0eac..124ab77 100644 --- a/app/views/products/show.html.erb +++ b/app/views/products/show.html.erb @@ -13,6 +13,11 @@ <%=h @product.image_url %> ++ Price: + <%=h @product.price %> +
+ <%= link_to 'Edit', edit_product_path(@product) %> | <%= link_to 'Back', products_path %> diff --git a/config/environment.rb b/config/environment.rb index 73cc3e4..bedc82c 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -5,7 +5,8 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION +# RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') diff --git a/db/migrate/20090128142730_add_product_price.rb b/db/migrate/20090128142730_add_product_price.rb new file mode 100644 index 0000000..f49426b --- /dev/null +++ b/db/migrate/20090128142730_add_product_price.rb @@ -0,0 +1,9 @@ +class AddProductPrice < ActiveRecord::Migration + def self.up + add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0 + end + + def self.down + remove_column :products, :price + end +end diff --git a/db/migrate/20090130111521_add_test_data.rb b/db/migrate/20090130111521_add_test_data.rb new file mode 100644 index 0000000..975146e --- /dev/null +++ b/db/migrate/20090130111521_add_test_data.rb @@ -0,0 +1,56 @@ +class AddTestData < ActiveRecord::Migration + def self.up + Product.delete_all + Product.create(:title => 'Pragmatic Project Automation', + :description => + %{+ Pragmatic Project Automation shows you how to improve the + consistency and repeatability of your project's procedures using + automation to reduce risk and errors. +
++ Simply put, we're going to put this thing called a computer to work + for you doing the mundane (but important) project stuff. That means + you'll have more time and energy to do the really + exciting—and difficult—stuff, like writing quality code. +
}, + :image_url => '/images/auto.jpg', + :price => 29.95) + + Product.create(:title => 'Pragmatic Version Control', + :description => + %{+ This book is a recipe-based approach to using Subversion that will + get you up and running quickly—and correctly. All projects need + version control: it's a foundational piece of any project's + infrastructure. Yet half of all project teams in the U.S. don't use + any version control at all. Many others don't use it well, and end + up experiencing time-consuming problems. +
}, + :image_url => '/images/svn.jpg', + :price => 28.50) + + Product.create(:title => 'Pragmatic Unit Testing (C#)', + :description => + %{+ Pragmatic programmers use feedback to drive their development and + personal processes. The most valuable feedback you can get while + coding comes from unit testing. +
++ Without good tests in place, coding can become a frustrating game of + "whack-a-mole." That's the carnival game where the player strikes at a + mechanical mole; it retreats and another mole pops up on the opposite side + of the field. The moles pop up and down so fast that you end up flailing + your mallet helplessly as the moles continue to pop up where you least + expect them. +
}, + :image_url => '/images/utc.jpg', + :price => 27.75) + + end + + def self.down + Product.delete_all + end +end diff --git a/db/schema.rb b/db/schema.rb index c702c8e..b873092 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20080724075409) do +ActiveRecord::Schema.define(:version => 20090130111521) do create_table "products", :force => true do |t| t.string "title" @@ -17,6 +17,7 @@ ActiveRecord::Schema.define(:version => 20080724075409) do t.string "image_url" t.datetime "created_at" t.datetime "updated_at" + t.decimal "price", :precision => 8, :scale => 2, :default => 0.0 end end diff --git a/log/development.log b/log/development.log index 0057ea8..95b56a7 100644 --- a/log/development.log +++ b/log/development.log @@ -141,3 +141,443 @@ Rendering template within layouts/products Rendering products/index [4;35;1mProduct Columns (0.003374)[0m [0mSHOW FIELDS FROM `products`[0m Completed in 0.02020 (49 reqs/sec) | Rendering: 0.00515 (25%) | DB: 0.00370 (18%) | 200 OK [http://localhost/products] + [4;36;1mSQL (0.3ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (17.9ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to CreateProducts (20080724075409) +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (222.8ms)[0m [0mALTER TABLE `products` ADD `price` decimal(8,2) DEFAULT 2[0m + [4;36;1mSQL (0.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20090128142730')[0m + [4;35;1mSQL (0.6ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.4ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (2.2ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mSQL (1.9ms)[0m [0mdescribe `products`[0m + [4;36;1mSQL (1.0ms)[0m [0;1mSHOW KEYS FROM `products`[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (27.2ms)[0m [0mALTER TABLE `products` DROP `price`[0m + [4;36;1mSQL (40.9ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090128142730'[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (26.4ms)[0m [0mDROP TABLE `products`[0m + [4;36;1mSQL (38.8ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20080724075409'[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.4ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (30.6ms)[0m [0mCREATE TABLE `products` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(255), `description` text, `image_url` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB[0m + [4;36;1mSQL (25.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20080724075409')[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (16.2ms)[0m [0mALTER TABLE `products` ADD `price` decimal(8,2) DEFAULT 0[0m + [4;36;1mSQL (0.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20090128142730')[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.4ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (3.6ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mSQL (1.9ms)[0m [0mdescribe `products`[0m + [4;36;1mSQL (0.6ms)[0m [0;1mSHOW KEYS FROM `products`[0m + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 10:55:37) [GET] + [4;36;1mSQL (41.3ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Load (49.7ms)[0m [0mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;36;1mProduct Columns (23.1ms)[0m [0;1mSHOW FIELDS FROM `products`[0m +Completed in 234ms (View: 147, DB: 114) | 200 OK [http://localhost/products] + + +Processing ProductsController#edit (for 127.0.0.1 at 2009-01-30 10:55:41) [GET] + Parameters: {"id"=>"1"} + [4;35;1mSQL (0.1ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Columns (1.1ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mProduct Load (23.3ms)[0m [0mSELECT * FROM `products` WHERE (`products`.`id` = 1) [0m +Rendering template within layouts/products +Rendering products/edit +Completed in 52ms (View: 16, DB: 24) | 200 OK [http://localhost/products/1/edit] + + +Processing ProductsController#update (for 127.0.0.1 at 2009-01-30 10:55:42) [PUT] + Parameters: {"commit"=>"Update", "authenticity_token"=>"f081ce86efd30d00f8269cdde39c0b562c696c34", "product"=>{"image_url"=>"", "price"=>"17.00", "title"=>"First product", "description"=>"This is the description of the first product"}, "id"=>"1"} + [4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Columns (1.2ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mProduct Load (0.3ms)[0m [0;1mSELECT * FROM `products` WHERE (`products`.`id` = 1) [0m + [4;35;1mSQL (0.7ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (62.9ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'First product' AND `products`.id <> 1) LIMIT 1[0m + [4;35;1mSQL (0.2ms)[0m [0mROLLBACK[0m +Rendering template within layouts/products +Rendering products/edit +Completed in 182ms (View: 22, DB: 65) | 200 OK [http://localhost/products/1] + + +Processing ProductsController#update (for 127.0.0.1 at 2009-01-30 10:56:00) [PUT] + Parameters: {"commit"=>"Update", "authenticity_token"=>"f081ce86efd30d00f8269cdde39c0b562c696c34", "product"=>{"image_url"=>"prod1", "price"=>"17.00", "title"=>"First product", "description"=>"This is the description of the first product"}, "id"=>"1"} + [4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Columns (1.3ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mProduct Load (0.1ms)[0m [0;1mSELECT * FROM `products` WHERE (`products`.`id` = 1) [0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.1ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'First product' AND `products`.id <> 1) LIMIT 1[0m + [4;35;1mSQL (0.2ms)[0m [0mROLLBACK[0m +Rendering template within layouts/products +Rendering products/edit +Completed in 42ms (View: 16, DB: 2) | 200 OK [http://localhost/products/1] + + +Processing ProductsController#update (for 127.0.0.1 at 2009-01-30 10:56:04) [PUT] + Parameters: {"commit"=>"Update", "authenticity_token"=>"f081ce86efd30d00f8269cdde39c0b562c696c34", "product"=>{"image_url"=>"prod1.png", "price"=>"17.00", "title"=>"First product", "description"=>"This is the description of the first product"}, "id"=>"1"} + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Columns (1.1ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mProduct Load (0.2ms)[0m [0;1mSELECT * FROM `products` WHERE (`products`.`id` = 1) [0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.1ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'First product' AND `products`.id <> 1) LIMIT 1[0m + [4;35;1mProduct Update (31.3ms)[0m [0mUPDATE `products` SET `updated_at` = '2009-01-30 10:56:04', `image_url` = 'prod1.png' WHERE `id` = 1[0m + [4;36;1mSQL (8.9ms)[0m [0;1mCOMMIT[0m +Redirected to #\n Pragmatic Project Automation shows you how to improve the \n consistency and repeatability of your project\'s procedures using \n automation to reduce risk and errors.\n
\n\n Simply put, we\'re going to put this thing called a computer to work \n for you doing the mundane (but important) project stuff. That means \n you\'ll have more time and energy to do the really \n exciting---and difficult---stuff, like writing quality code.\n
', '2009-01-30 11:21:28')[0m + [4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.4ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Version Control') LIMIT 1[0m + [4;35;1mSQL (0.1ms)[0m [0mROLLBACK[0m + [4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m + [4;35;1mProduct Exists (0.4ms)[0m [0mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Unit Testing (C#)') LIMIT 1[0m + [4;36;1mProduct Create (0.4ms)[0m [0;1mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/utc.jpg', '2009-01-30 11:21:28', 'Pragmatic Unit Testing (C#)', 27.75, '\n Pragmatic programmers use feedback to drive their development and \n personal processes. The most valuable feedback you can get while \n coding comes from unit testing.\n
\n\n Without good tests in place, coding can become a frustrating game of \n \"whack-a-mole.\" That\'s the carnival game where the player strikes at a \n mechanical mole; it retreats and another mole pops up on the opposite side \n of the field. The moles pop up and down so fast that you end up flailing \n your mallet helplessly as the moles continue to pop up where you least \n expect them.\n
', '2009-01-30 11:21:28')[0m + [4;35;1mSQL (0.5ms)[0m [0mCOMMIT[0m + [4;36;1mSQL (23.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20090130111521')[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.3ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (1.0ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mSQL (1.1ms)[0m [0mdescribe `products`[0m + [4;36;1mSQL (0.5ms)[0m [0;1mSHOW KEYS FROM `products`[0m + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:21:36) [GET] + [4;35;1mSQL (0.1ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Load (0.7ms)[0m [0;1mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;35;1mProduct Columns (1.1ms)[0m [0mSHOW FIELDS FROM `products`[0m +Completed in 34ms (View: 19, DB: 2) | 200 OK [http://localhost/products] + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to AddTestData (20090130111521) + [4;35;1mProduct Delete all (7.2ms)[0m [0mDELETE FROM `products` [0m + [4;36;1mSQL (9.5ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090130111521'[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (174.7ms)[0m [0mALTER TABLE `products` DROP `price`[0m + [4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090128142730'[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (1.4ms)[0m [0mDROP TABLE `products`[0m + [4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20080724075409'[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.4ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (6.1ms)[0m [0mCREATE TABLE `products` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(255), `description` text, `image_url` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB[0m + [4;36;1mSQL (0.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20080724075409')[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (8.7ms)[0m [0mALTER TABLE `products` ADD `price` decimal(8,2) DEFAULT 0[0m + [4;36;1mSQL (0.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20090128142730')[0m +Migrating to AddTestData (20090130111521) + [4;35;1mProduct Delete all (9.7ms)[0m [0mDELETE FROM `products` [0m + [4;36;1mProduct Columns (2.1ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mSQL (0.2ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.5ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Project Automation') LIMIT 1[0m + [4;35;1mProduct Create (0.4ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/auto.jpg', '2009-01-30 11:22:38', 'Pragmatic Project Automation', 29.95, '\n Pragmatic Project Automation shows you how to improve the \n consistency and repeatability of your project\'s procedures using \n automation to reduce risk and errors.\n
\n\n Simply put, we\'re going to put this thing called a computer to work \n for you doing the mundane (but important) project stuff. That means \n you\'ll have more time and energy to do the really \n exciting---and difficult---stuff, like writing quality code.\n
', '2009-01-30 11:22:38')[0m + [4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.2ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.4ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Version Control') LIMIT 1[0m + [4;35;1mProduct Create (0.4ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/svn.jpg', '2009-01-30 11:22:38', 'Pragmatic Version Control', 28.5, '\n This book is a recipe-based approach to using Subversion that will \n get you up and running quickly---and correctly. All projects need\n version control: it\'s a foundational piece of any project\'s \n infrastructure. Yet half of all project teams in the U.S. don\'t use\n any version control at all. Many others don\'t use it well, and end \n up experiencing time-consuming problems.\n
', '2009-01-30 11:22:38')[0m + [4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.2ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.4ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Unit Testing (C#)') LIMIT 1[0m + [4;35;1mProduct Create (0.5ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/utc.jpg', '2009-01-30 11:22:38', 'Pragmatic Unit Testing (C#)', 27.75, '\n Pragmatic programmers use feedback to drive their development and \n personal processes. The most valuable feedback you can get while \n coding comes from unit testing.\n
\n\n Without good tests in place, coding can become a frustrating game of \n \"whack-a-mole.\" That\'s the carnival game where the player strikes at a \n mechanical mole; it retreats and another mole pops up on the opposite side \n of the field. The moles pop up and down so fast that you end up flailing \n your mallet helplessly as the moles continue to pop up where you least \n expect them.\n
', '2009-01-30 11:22:38')[0m + [4;36;1mSQL (6.3ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (13.7ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('20090130111521')[0m + [4;36;1mSQL (0.5ms)[0m [0;1mSHOW TABLES[0m + [4;35;1mSQL (0.4ms)[0m [0mSELECT version FROM schema_migrations[0m + [4;36;1mSQL (0.5ms)[0m [0;1mSHOW TABLES[0m + [4;35;1mSQL (1.8ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mSQL (1.8ms)[0m [0;1mdescribe `products`[0m + [4;35;1mSQL (0.7ms)[0m [0mSHOW KEYS FROM `products`[0m + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:22:43) [GET] + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Load (0.4ms)[0m [0mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;36;1mProduct Columns (1.1ms)[0m [0;1mSHOW FIELDS FROM `products`[0m +Completed in 31ms (View: 17, DB: 2) | 200 OK [http://localhost/products] + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to AddTestData (20090130111521) + [4;35;1mProduct Delete all (5.1ms)[0m [0mDELETE FROM `products` [0m + [4;36;1mSQL (12.1ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090130111521'[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (30.2ms)[0m [0mALTER TABLE `products` DROP `price`[0m + [4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090128142730'[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (2.0ms)[0m [0mDROP TABLE `products`[0m + [4;36;1mSQL (6.3ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20080724075409'[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.4ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (1.2ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (3.4ms)[0m [0mCREATE TABLE `products` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(255), `description` text, `image_url` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB[0m + [4;36;1mSQL (0.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20080724075409')[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (6.6ms)[0m [0mALTER TABLE `products` ADD `price` decimal(8,2) DEFAULT 0[0m + [4;36;1mSQL (0.7ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20090128142730')[0m +Migrating to AddTestData (20090130111521) + [4;35;1mProduct Delete all (0.4ms)[0m [0mDELETE FROM `products` [0m + [4;36;1mProduct Columns (1.1ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.6ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Project Automation') LIMIT 1[0m + [4;35;1mProduct Create (0.6ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/auto.jpg', '2009-01-30 11:26:48', 'Pragmatic Project Automation', 29.95, '\n Pragmatic Project Automation shows you how to improve the \n consistency and repeatability of your project\'s procedures using \n automation to reduce risk and errors.\n
\n\n Simply put, we\'re going to put this thing called a computer to work \n for you doing the mundane (but important) project stuff. That means \n you\'ll have more time and energy to do the really \n exciting---and difficult---stuff, like writing quality code.\n
', '2009-01-30 11:26:48')[0m + [4;36;1mSQL (0.7ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.4ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Version Control') LIMIT 1[0m + [4;35;1mProduct Create (1.0ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/svn.jpg', '2009-01-30 11:26:48', 'Pragmatic Version Control', 28.5, '\n This book is a recipe-based approach to using Subversion that will \n get you up and running quickly&emdash;and correctly. All projects need\n version control: it\'s a foundational piece of any project\'s \n infrastructure. Yet half of all project teams in the U.S. don\'t use\n any version control at all. Many others don\'t use it well, and end \n up experiencing time-consuming problems.\n
', '2009-01-30 11:26:48')[0m + [4;36;1mSQL (1.8ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.4ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Unit Testing (C#)') LIMIT 1[0m + [4;35;1mProduct Create (0.4ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/utc.jpg', '2009-01-30 11:26:48', 'Pragmatic Unit Testing (C#)', 27.75, '\n Pragmatic programmers use feedback to drive their development and \n personal processes. The most valuable feedback you can get while \n coding comes from unit testing.\n
\n\n Without good tests in place, coding can become a frustrating game of \n \"whack-a-mole.\" That\'s the carnival game where the player strikes at a \n mechanical mole; it retreats and another mole pops up on the opposite side \n of the field. The moles pop up and down so fast that you end up flailing \n your mallet helplessly as the moles continue to pop up where you least \n expect them.\n
', '2009-01-30 11:26:48')[0m + [4;36;1mSQL (2.0ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (8.2ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('20090130111521')[0m + [4;36;1mSQL (0.4ms)[0m [0;1mSHOW TABLES[0m + [4;35;1mSQL (0.3ms)[0m [0mSELECT version FROM schema_migrations[0m + [4;36;1mSQL (0.3ms)[0m [0;1mSHOW TABLES[0m + [4;35;1mSQL (1.0ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mSQL (1.0ms)[0m [0;1mdescribe `products`[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW KEYS FROM `products`[0m + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:26:52) [GET] + [4;35;1mSQL (0.1ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Load (0.4ms)[0m [0;1mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;35;1mProduct Columns (1.1ms)[0m [0mSHOW FIELDS FROM `products`[0m +Completed in 37ms (View: 24, DB: 2) | 200 OK [http://localhost/products] + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.5ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to AddTestData (20090130111521) + [4;35;1mProduct Delete all (12.5ms)[0m [0mDELETE FROM `products` [0m + [4;36;1mSQL (12.4ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090130111521'[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (22.2ms)[0m [0mALTER TABLE `products` DROP `price`[0m + [4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20090128142730'[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (6.1ms)[0m [0mDROP TABLE `products`[0m + [4;36;1mSQL (0.9ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '20080724075409'[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.3ms)[0m [0;1mSELECT version FROM schema_migrations[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m + [4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m +Migrating to CreateProducts (20080724075409) + [4;35;1mSQL (4.6ms)[0m [0mCREATE TABLE `products` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(255), `description` text, `image_url` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB[0m + [4;36;1mSQL (0.7ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20080724075409')[0m +Migrating to AddProductPrice (20090128142730) + [4;35;1mSQL (7.3ms)[0m [0mALTER TABLE `products` ADD `price` decimal(8,2) DEFAULT 0[0m + [4;36;1mSQL (0.8ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20090128142730')[0m +Migrating to AddTestData (20090130111521) + [4;35;1mProduct Delete all (1.1ms)[0m [0mDELETE FROM `products` [0m + [4;36;1mProduct Columns (2.5ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mSQL (0.2ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.5ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Project Automation') LIMIT 1[0m + [4;35;1mProduct Create (0.4ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/auto.jpg', '2009-01-30 11:28:11', 'Pragmatic Project Automation', 29.95, '\n Pragmatic Project Automation shows you how to improve the \n consistency and repeatability of your project\'s procedures using \n automation to reduce risk and errors.\n
\n\n Simply put, we\'re going to put this thing called a computer to work \n for you doing the mundane (but important) project stuff. That means \n you\'ll have more time and energy to do the really \n exciting—and difficult—stuff, like writing quality code.\n
', '2009-01-30 11:28:11')[0m + [4;36;1mSQL (0.5ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.1ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.4ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Version Control') LIMIT 1[0m + [4;35;1mProduct Create (0.3ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/svn.jpg', '2009-01-30 11:28:11', 'Pragmatic Version Control', 28.5, '\n This book is a recipe-based approach to using Subversion that will \n get you up and running quickly—and correctly. All projects need\n version control: it\'s a foundational piece of any project\'s \n infrastructure. Yet half of all project teams in the U.S. don\'t use\n any version control at all. Many others don\'t use it well, and end \n up experiencing time-consuming problems.\n
', '2009-01-30 11:28:11')[0m + [4;36;1mSQL (0.5ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.2ms)[0m [0mBEGIN[0m + [4;36;1mProduct Exists (0.6ms)[0m [0;1mSELECT `products`.id FROM `products` WHERE (`products`.`title` = BINARY 'Pragmatic Unit Testing (C#)') LIMIT 1[0m + [4;35;1mProduct Create (0.3ms)[0m [0mINSERT INTO `products` (`image_url`, `updated_at`, `title`, `price`, `description`, `created_at`) VALUES('/images/utc.jpg', '2009-01-30 11:28:11', 'Pragmatic Unit Testing (C#)', 27.75, '\n Pragmatic programmers use feedback to drive their development and \n personal processes. The most valuable feedback you can get while \n coding comes from unit testing.\n
\n\n Without good tests in place, coding can become a frustrating game of \n \"whack-a-mole.\" That\'s the carnival game where the player strikes at a \n mechanical mole; it retreats and another mole pops up on the opposite side \n of the field. The moles pop up and down so fast that you end up flailing \n your mallet helplessly as the moles continue to pop up where you least \n expect them.\n
', '2009-01-30 11:28:11')[0m + [4;36;1mSQL (1.3ms)[0m [0;1mCOMMIT[0m + [4;35;1mSQL (0.7ms)[0m [0mINSERT INTO schema_migrations (version) VALUES ('20090130111521')[0m + [4;36;1mSQL (0.9ms)[0m [0;1mSHOW TABLES[0m + [4;35;1mSQL (0.4ms)[0m [0mSELECT version FROM schema_migrations[0m + [4;36;1mSQL (0.3ms)[0m [0;1mSHOW TABLES[0m + [4;35;1mSQL (1.0ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mSQL (1.3ms)[0m [0;1mdescribe `products`[0m + [4;35;1mSQL (0.4ms)[0m [0mSHOW KEYS FROM `products`[0m + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:28:19) [GET] + [4;36;1mSQL (0.3ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Load (1.3ms)[0m [0mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;36;1mProduct Columns (1.2ms)[0m [0;1mSHOW FIELDS FROM `products`[0m +Completed in 30ms (View: 15, DB: 3) | 200 OK [http://localhost/products] + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:53:52) [GET] + [4;35;1mSQL (0.2ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Load (0.3ms)[0m [0;1mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;35;1mProduct Columns (1.3ms)[0m [0mSHOW FIELDS FROM `products`[0m +Completed in 41ms (View: 24, DB: 2) | 200 OK [http://localhost/products] + + +Processing ProductsController#show (for 127.0.0.1 at 2009-01-30 11:53:55) [GET] + Parameters: {"id"=>"1"} + [4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Columns (2.1ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mProduct Load (0.7ms)[0m [0;1mSELECT * FROM `products` WHERE (`products`.`id` = 1) [0m +Rendering template within layouts/products +Rendering products/show +Completed in 41ms (View: 20, DB: 3) | 200 OK [http://localhost/products/1] + + +Processing ProductsController#show (for 127.0.0.1 at 2009-01-30 11:54:35) [GET] + Parameters: {"id"=>"3"} + [4;35;1mSQL (0.1ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Columns (1.3ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mProduct Load (0.4ms)[0m [0mSELECT * FROM `products` WHERE (`products`.`id` = 3) [0m +Rendering template within layouts/products +Rendering products/show +Completed in 29ms (View: 14, DB: 2) | 200 OK [http://localhost/products/3] + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:54:44) [GET] + [4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Load (0.3ms)[0m [0mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;36;1mProduct Columns (1.2ms)[0m [0;1mSHOW FIELDS FROM `products`[0m +Completed in 39ms (View: 24, DB: 2) | 200 OK [http://localhost/products] + + +Processing ProductsController#show (for 127.0.0.1 at 2009-01-30 11:55:35) [GET] + Parameters: {"id"=>"3"} + [4;35;1mSQL (0.1ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Columns (1.1ms)[0m [0;1mSHOW FIELDS FROM `products`[0m + [4;35;1mProduct Load (0.1ms)[0m [0mSELECT * FROM `products` WHERE (`products`.`id` = 3) [0m +Rendering template within layouts/products +Rendering products/show +Completed in 27ms (View: 13, DB: 1) | 200 OK [http://localhost/products/3] + + +Processing ProductsController#edit (for 127.0.0.1 at 2009-01-30 11:55:43) [GET] + Parameters: {"id"=>"2"} + [4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Columns (1.9ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mProduct Load (0.5ms)[0m [0;1mSELECT * FROM `products` WHERE (`products`.`id` = 2) [0m +Rendering template within layouts/products +Rendering products/edit +Completed in 33ms (View: 18, DB: 2) | 200 OK [http://localhost/products/2/edit] + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:56:05) [GET] + [4;35;1mSQL (0.2ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Load (0.2ms)[0m [0;1mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;35;1mProduct Columns (1.1ms)[0m [0mSHOW FIELDS FROM `products`[0m +Completed in 35ms (View: 20, DB: 1) | 200 OK [http://localhost/products] + + +Processing ProductsController#show (for 127.0.0.1 at 2009-01-30 11:56:08) [GET] + Parameters: {"id"=>"2"} + [4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m + [4;35;1mProduct Columns (1.1ms)[0m [0mSHOW FIELDS FROM `products`[0m + [4;36;1mProduct Load (0.2ms)[0m [0;1mSELECT * FROM `products` WHERE (`products`.`id` = 2) [0m +Rendering template within layouts/products +Rendering products/show +Completed in 26ms (View: 12, DB: 1) | 200 OK [http://localhost/products/2] + + +Processing ProductsController#index (for 127.0.0.1 at 2009-01-30 11:56:25) [GET] + [4;35;1mSQL (0.1ms)[0m [0mSET SQL_AUTO_IS_NULL=0[0m + [4;36;1mProduct Load (0.2ms)[0m [0;1mSELECT * FROM `products` [0m +Rendering template within layouts/products +Rendering products/index + [4;35;1mProduct Columns (1.9ms)[0m [0mSHOW FIELDS FROM `products`[0m +Completed in 35ms (View: 21, DB: 2) | 200 OK [http://localhost/products] diff --git a/public/stylesheets/depot.css b/public/stylesheets/depot.css new file mode 100644 index 0000000..bb9c8b5 --- /dev/null +++ b/public/stylesheets/depot.css @@ -0,0 +1,141 @@ +/* Global styles */ + +h1 { + font: 150% sans-serif; + color: #226; + border-bottom: 3px dotted #77d; +} + +/* Styles for products/index */ + +#product-list table { + border-collapse: collapse; +} + +#product-list table tr td { + padding: 5px; + vertical-align: top; +} + +#product-list .list-image { + width: 60px; + height: 70px; +} + +#product-list .list-description { + width: 60%; +} + +#product-list .list-description dl { + margin: 0; +} + +#product-list .list-description dt { + color: #244; + font-weight: bold; + font-size: larger; +} + +#product-list .list-description dd { + margin: 0; +} + +#product-list .list-actions { + font-size: x-small; + text-align: right; + padding-left: 1em; +} + +#product-list .list-line-even { + background: #e0f8f8; +} + +#product-list .list-line-odd { + background: #f8b0f8; +} + +/* An entry in the store catalog */ + +#store .entry { + overflow: auto; + margin-top: 1em; + border-bottom: 1px dotted #77d; +} + +#store .title { + font-size: 120%; + font-family: sans-serif; +} + +#store .entry img { + width: 75px; + float: left; +} + + +#store .entry h3 { + margin-top: 0; + margin-bottom: 2px; + color: #227; +} + +#store .entry p { + margin-top: 0.5em; + margin-bottom: 0.8em; +} + +#store .entry .price-line { + clear: both; +} + +#store .entry .add-to-cart { + position: relative; +} + +#store .entry .price { + color: #44a; + font-weight: bold; + margin-right: 2em; +} + +/* The error box */ + +.fieldWithErrors { + padding: 2px; + background-color: #EEFFEE; + display: inline; +} + +.fieldWithErrors * { + background-color: red; +} + +#errorExplanation { + width: 400px; + border: 2px solid red; + padding: 7px; + padding-bottom: 12px; + margin-bottom: 20px; + background-color: #f0f0f0; +} + +#errorExplanation h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + background-color: #c00; + color: #fff; +} + +#errorExplanation p { + color: #333; + margin-bottom: 0; + padding: 5px; +} + +#errorExplanation ul li { + font-size: 12px; + list-style: square; +} -- 2.34.1