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_
The way I found, was to do a migration on an existing datetime column, like this:
#migration
execute("ALTER TABLE teams ALTER COLUMN wk1_time SET DEFAULT CURRENT_TIMESTAMP")
that produces a schema.rb entry shown like this:
#schema.rb
t.datetime "wk1_time", default: "now()", null: false
The "now()"
is a string sent to postgresql and evaluated at runtime, upon each insert