Rails 有无好 gem 来注释 migrate?

hhuai · July 21, 2012 · Last by hhuai replied at July 21, 2012 · 2971 hits

我一般建表先写中文字段描述,然后在 migrate 脚本写英文字段, 发现 migrate 不支持下面这种写法 t.string :name, :comment => "企业名称" 最好能直接 comment 到 annotate 上。

找了一通,其中有个小日本写的 schema_comments. bug 多得我改不过来,放弃。

请教大家怎么做的?

如果没有可以一起搞一个啊

技术讨论不要掺杂种族歧视色彩的词语。

#1 楼 @hooopo 你也有需求?

顺便社区有提供喜欢按钮,能顺便提供一个讨厌按钮吗。。

可以用 annotator https://github.com/lucasefe/annotator 生成的注释是在 model 上,这样更直接 方便的是,自己可以修改这些注释,跟新 schema 的时候也不会被覆盖

# Attributes: # * id [integer, primary, not null, limit=4] - primary key # * body [text] - TODO: document me # * created_at [datetime] - creation time # * title [string] - TODO: document me

#4 楼 @allenwei 谢谢,很不错,you save my life.

You need to Sign in before reply, if you don't have an account, please Sign up first.