私は2つのモデルを持っています
Order has_many State(s)
State belongs_to Order
a State has an attribute named 'kind'
次のクエリをアクティブなレコードで表現しようとしています: 'current_state.kind = :something を持つすべての注文',
current_state は、注文に対して最後に作成された状態です。
また、モデル :current_state を has_one 関連付けとして追加します。
has_one :current_state, -> { order('created_at DESC').limit(1) }, class_name: 'State'
しかし、それは役に立ちません