LoginSignup
0
0

More than 1 year has passed since last update.

[Rails]annotate

Posted at

概要

DBのテーブル定義をmodel、specファイルの上部にコメントで一覧として書き出してくれるgem

導入手順

(前提: ver.3.1.1.を導入したときの話)
gem「rspec」, 「factory_bot」を導入済み

# 1. Gemfileにannotateを記述
# 2. bundle installを実行
# 3. rails g annotate:installを実行
=>lib/tasks/auto_annotate_models.rakeが作成される

利用手順

# 対象ファイルすべてにコメントを付与
bundle exec annotate
=>以下ファイルすべてにmodelのテーブル定義がコメントとして付与される
- app/models/<model>.rb
- spec/models/<model>_spec.rb
- spec/factories/<models>.rb

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0