In my app I have teams and each team has a game time every week. I want the game times to be set to \'now\' as a default. My table is set up like so
create_
You're going to run into problems settings the default date time in the migration. This is because DateTime.now
will be evaluated based upon when the migrate runs, not when the record is created!
To fix that you'll need to create an ActiveRecord callback in order to set wk1_time
like so:
before_create :set_default_wk1_datetime
def set_default_wk1_datetime
self.wk1_time = DateTime.now
end