Renaming the created_at, updated_at columns of ActiveRecord/Rails

前端 未结 10 662
囚心锁ツ
囚心锁ツ 2020-11-28 07:02

I want to rename the timestamp columns defined in timestamp.rb . Can the methods of timestamp.rb be overwritten? And what has to be done in the application that the module w

10条回答
  •  鱼传尺愫
    2020-11-28 08:00

    There is no simple way to do that. You can accomplish this either by overriding the ActiveRecord::Timestamp module, or by writing your own one to do the magic for you.

    Here is how the magic works.

提交回复
热议问题