重命名created_at,的updated_at的ActiveRecord / Rails的列重命名、created_at、updated_at、ActiveRecord

由网友(孤屿囚心)分享简介:我要重命名timestamp.rb定义的时间戳列。timestamp.rb的方法可以被覆盖?和什么必须在与该覆盖方法在模块中使用的应用程序完成。I want to rename the timestamp columns defined in timestamp.rb .Can the methods of ti...

我要重命名timestamp.rb定义的时间戳列。 timestamp.rb的方法可以被覆盖?和什么必须在与该覆盖方法在模块中使用的应用程序完成。

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 with the overwritten methods is used.

推荐答案

有没有简单的方法来做到这一点。您可以通过重写的ActiveRecord ::时间戳模块,也可以通过写你自己一个人做的魔力为你做到这一点。

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.

以下是中如何变魔术。

阅读全文

相关推荐

最新文章