SchemaをModelにコメントとして書き出してくれるGem annotate
導入
Gemfileにannotate
を追加してbundle install で導入できる。
Schema情報の追加
実行する。
Table Schemaをコメントとして追加するコマンド
bundle exec annotate
結果
以下のように書き込まれる。便利〜
# == Schema Information # # Table name: hoge_fuga_piyo # # id :integer not null, primary key # user_id :integer not null # created_at :datetime not null # updated_at :datetime not null # hoge huga piyopiyo