重命名created_at,的updated_at的ActiveRecord / Rails的列 [英] Renaming the created_at, updated_at columns of ActiveRecord/Rails

查看:235
本文介绍了重命名created_at,的updated_at的ActiveRecord / Rails的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要重命名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.

<一个href="http://github.com/rails/rails/blob/63aac338332a06d3c9e28dde7954679703ec7620/activerecord/lib/active%5Frecord/timestamp.rb"相对=nofollow>以下是中如何变魔术。

这篇关于重命名created_at,的updated_at的ActiveRecord / Rails的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆