Use a text field for the customers address
authorIra W. Snyder <devel@irasnyder.com>
Thu, 22 Nov 2007 05:20:41 +0000 (21:20 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Thu, 22 Nov 2007 05:20:41 +0000 (21:20 -0800)
This is probably a better decision than just using a string. I can break it
into address pieces later, but that can wait.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
app/views/customer/_form.rhtml
db/development.sqlite3
db/migrate/010_customers_text_address.rb [new file with mode: 0644]
db/schema.rb

index df2a4b0..3107334 100644 (file)
@@ -5,7 +5,7 @@
 <%= text_field 'customer', 'name'  %></p>
 
 <p><label for="customer_address">Address</label><br/>
-<%= text_field 'customer', 'address'  %></p>
+<%= text_area 'customer', 'address'  %></p>
 
 <p><label for="customer_email">Email</label><br/>
 <%= text_field 'customer', 'email'  %></p>
index 1c7c325..72eb9b0 100644 (file)
Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ
diff --git a/db/migrate/010_customers_text_address.rb b/db/migrate/010_customers_text_address.rb
new file mode 100644 (file)
index 0000000..7e9d968
--- /dev/null
@@ -0,0 +1,9 @@
+class CustomersTextAddress < ActiveRecord::Migration
+  def self.up
+    change_column :customers, :address, :text
+  end
+
+  def self.down
+    change_column :customers, :address, :string
+  end
+end
index 692ee89..5c26969 100644 (file)
@@ -2,7 +2,7 @@
 # migrations feature of ActiveRecord to incrementally modify your database, and
 # then regenerate this schema definition.
 
-ActiveRecord::Schema.define(:version => 9) do
+ActiveRecord::Schema.define(:version => 10) do
 
   create_table "coitems", :force => true do |t|
     t.column "customer_id", :integer
@@ -13,10 +13,10 @@ ActiveRecord::Schema.define(:version => 9) do
 
   create_table "customers", :force => true do |t|
     t.column "name",    :string
-    t.column "address", :string
+    t.column "address", :text,    :limit => 255
     t.column "email",   :string
     t.column "phone",   :string
-    t.column "debt",    :decimal, :precision => 8, :scale => 2, :default => 0.0
+    t.column "debt",    :decimal,                :default => 0.0
   end
 
   create_table "rentables", :force => true do |t|