私は3つのモデルを持っています:
Article (:title)
has_many :units
Dealer (:name, :adress)
has_many :units
Unit (:price, :dealer_id, :article_id)
belongs_to :article
belongs_to :dealer
自分のテーブルが完全に正しいかどうかわかりません。また、 has_many :through を使用する必要があるのか、それとも has:many を使用して所属するだけなのかわかりません。違いは正確には何ですか?
そして、レールクエリはどのように見えるでしょうか?
Article.find(:name => "Cheese").units
Article.find(:name => "cheese").units.minimum('price').dealer
このような複雑な Rails クエリは、この種の関係で機能しますか?