重命名 ActiveRecord/Rails 的 created_at、updated_at 列 [英] Renaming the created_at, updated_at columns of ActiveRecord/Rails
本文介绍了重命名 ActiveRecord/Rails 的 created_at、updated_at 列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想重命名在 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::Timestamp 模块或编写自己的模块来实现这一点.
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.
这就是有效.
这篇关于重命名 ActiveRecord/Rails 的 created_at、updated_at 列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文