Migrate a Single Database Migration
January 21, 2013rails console
require "db/migrate/20121130134444_add_column_backorder_to_orders.rb"
AddColumnBackorderToOrders.up
rails console
require "db/migrate/20121130134444_add_column_backorder_to_orders.rb"
AddColumnBackorderToOrders.up
Date.parse '2013/1/15'
DateTime.parse('2013/1/15'+'-23:59:59-6:00')
From the rails console.
helper.text_field :object, :name
"<input id="object_name" name="object[name]" size="30" type="text" />"
I like to set default values in my models. This is the method I like to use.
def after_initialize
if new_record?
self.upper_quantity ||= 0.0
end
end
Everytime my server looses power, Mongo has trouble restarting. These commands fixes the problem.
sudo rm /var/lib/mongodb/mongod.lock
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo service mongodb restart