Added date_available_from to products, updated conditions in product.find_products_fo...
[depot.git] / db / migrate / 20090226212307_add_more_test_data.rb
diff --git a/db/migrate/20090226212307_add_more_test_data.rb b/db/migrate/20090226212307_add_more_test_data.rb
new file mode 100644 (file)
index 0000000..d91721b
--- /dev/null
@@ -0,0 +1,31 @@
+class AddMoreTestData < ActiveRecord::Migration
+  def self.up
+    Product.create(:title => 'Rainbow',
+      :description => 
+        %{<p>What could be better than a beautiful rainbow to brighten up your 
+             day?  Experience the wonder of light and water in all its glory.
+          </p>
+          <p>Due to metreological variations, the rainbow you receive may 
+             differ slightly from the one shown here.
+          </p>
+          <p>(Terminal gold not included.)
+          </p>
+        },
+        :image_url => '/images/rainbow.jpg',
+        :price => 17.99,
+        :date_available => Time.utc(2008, 12, 31),
+        :date_available_until => Time.utc(2009, 1, 1)
+#        :available_until => 'fred'
+#        :au => Time.utc(2008, 12, 31)
+    )
+
+    box = Product.find(3)
+    box.update_attribute(:date_available_until, Time.utc(2010, 7, 1))
+#    box.update_attribute(:available_until, 'tom')
+#    box.update_attribute(:au, Time.utc(2010, 7, 1))
+  end
+
+  def self.down
+    Product.delete_all(["title = ?", 'Rainbow'])
+  end
+end