I have the following in a migration:
create_table :orders do |t| t.references :cart t.references :user t.float :item_total, :default => 0.0, :null => false t.float :discount, :default => 0.0, :null => false t.float :tax, :default => 0.0, :null => false t.string :shipping_type t.float :shipping_cost, :default => 0.0, :null => false t.float :total, :default => 0.0, :null => false t.string :tracking t.datetime :placed_at, :default => '0000-00-00 00:00:00', :null => false t.datetime :shipped_at, :default => '0000-00-00 00:00:00', :null => false
t.timestamps end
But when I look at scheme.rb I see:
create_table "orders", :force => true do |t| t.integer "cart_id" t.integer "user_id" t.float "item_total", :default => 0.0, :null => false t.float "discount", :default => 0.0, :null => false t.float "tax", :default => 0.0, :null => false t.string "shipping_type" t.float "shipping_cost", :default => 0.0, :null => false t.float "total", :default => 0.0, :null => false t.string "tracking" t.datetime "placed_at", :null => false t.datetime "shipped_at", :null => false t.datetime "created_at" t.datetime "updated_at" end
As you can see, the "default" value did not take. Yet it did for the floats that default to 0.0
When I try to save an object of class order I get errors saying the placed_at and shipped_at can not be null. (Which makes sense giving what I've pasted above).
How can I make those two fields default to "0000-00-00 00:00:00"?
Thanks, Greg