简介
Annotate models能够以注释的方式在Model顶部自动生成此Model的大纲(schema)信息,并可以在Model的大纲发生变化后自动更新。
对于拥有许多Model的大型项目来说,在Model相关文件中维护此model的大纲信息就显得尤为重要,你不需要去db/migrate目录下搜寻此 Model相关的Migration文件,也不需要去mysql中敲describe XXX命令,就可以迅速了解此Model对应的表拥有那些字段。
作者:Dave Thomas
SVN仓库:http://repo.pragprog.com/svn/Public/plugins/annotate_models
许可:Ruby License
安装
$ ./script/plugin install http://repo.pragprog.com/svn/Public/plugins/annotate_models
使用
$ rake annotate_models
这将会在所有Model文件及Fixture文件的头部添加此Model的大纲信息,添加的大纲信息看起来是下面这个样子:
# == Schema Information
# Schema version: 1
#
# Table name: users
#
# id :integer(11) not null, primary key
# login :string(255)
# email :string(255)
# crypted_password :string(40)
# salt :string(40)
# created_at :datetime
# updated_at :datetime
# remember_token :string(255)
# remember_token_expires_at :datetime
# activation_code :string(40)
# activated_at :datetime
#
觉得这个插件不错?那就去这里为它投上一票吧!
