ctran/annotate_models: Annotate Rails classes with schema and routes info
annotate gemとは、モデルファイルに以下のようなスキーマ情報を記述してくれるgem。好き嫌いはあるようだけど、いちいちスキーマファイルを見に行かなくて済むので個人的には好き。
# == Schema Information # # Table name: users # # id :integer not null, primary key # name :string # created_at :datetime not null # updated_at :datetime not null # class User < ApplicationRecord end
導入。
group :development do gem 'annotate' end
設定ファイルを作成。
rails g annotate:install
実行。
bundle exec annotate
基本的にはこれだけ。
ルーティング情報とかも書き出せるみたいだが、膨大な量のルーティングが記述されるので好き嫌いが激しそうな印象。