I need to add timestamps (created_at & updated_at) to an existing table. I tried the following code but it didn\'t work.
created_at
updated_at
class
I personally used the following, and it updated all previous records with the current time/date:
add_column :, :created_at, :datetime, default: Time.zone.now, null: false add_column :, :updated_at, :datetime, default: Time.zone.now, null: false 0 讨论(0) 查看其它21个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题