もりきゅうさん。お返事ありがとうございます。十河です。
 
find(:all, :conditions => "users.name =boo ", :include => :user)
 
でうまくできました。includeはleft outer joinになるのですね。
ありがとうございました!

 
06/01/10 に Kazuhiro Yoshida <moriq@moriq.com> さんは書きました:
もりきゅうです。

manabu togawa wrote:
> class Comment < ActiveRecord::Base
>   belongs_to :user
> end class
>
> のようなクラスがある場合に
>
> Commentクラスからfind(:all, :conditions => "user.name =boo ")
>
> のように親テーブル(usrs)のnameを条件としたcommentの一覧を取得したいと
> 思っています。

find(:all, :conditions => "user.name =boo ", :include => :user)
でいけると思います。

--
ML: rails@ruby.ml.fdiary.net
使い方: http://QuickML.com/