ctran/annotate_models: Annotate Rails classes with schema and routes info
こんな感じで、migrateのタイミングで自動的にモデル関連ファイルにannotate(コメント)を追加してくれるgemです。
これがいつの間にか動かなくなっていました。
# == Schema Info
#
# Table name: line_items
#
# id :integer(11) not null, primary key
# quantity :integer(11) not null
# product_id :integer(11) not null
# unit_price :float
# order_id :integer(11)
#
class LineItem < ActiveRecord::Base
belongs_to :product
. . .
原因
ctran/annotate_models: Annotate Rails classes with schema and routes info https://github.com/ctran/annotate_models#upgrading-to-3x-and-annotate-models-not-working
ここに書いている通りですが、version3からmodels
オプションが追加され、これをtrueにしないと動作しなくなっていました。
注意点
別途classified-sort
オプションも追加されており、これがdefaultになっています。
Sort columns alphabetically, but first goes id, then the rest columns, then the timestamp columns and then the association columns
id, その他のカラム、timestamp、assosiationの順でannotateが追加されるとのこと。
version2と同じ挙動にしたい場合(DBと同じ)は、falseにすると良いです。