Find question

John Burm
2007-04-19T18:31:49Z

Hello All,

Quick find question for you, I have a comments, users and a friends
table.

The user model has_many :friends, :through => :friendships

How can I include the friends comments in a find? (I know the below does
not work, it just pulls up the @user''s comments) but if i substitute in
([@user, 4, ... It works fine pulling in the @user.id''s comments and
the
user who''s ID is 4 in as well.

@comments = Comment.find_all_by_user_id([@user, @user.friends],
                                          :include =>
[:user,:method_type],
                                          :order  => "comments.id
DESC",
                                          :limit  => "10")

Thank you in advance,
 - John

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---