Message.all(:conditions => {:user_id => current_user.friends})

assuming the table messages has a column user_id.


On Mar 15, 10:27 pm, comopasta Gr <[email protected]>
wrote:
> Hi,
>
> I have an app where users have friends, and friends can have messages
> for friends to see. I would like to list all the messages that my
> friends have easily.
>
> I can use @user_friends = current_user.friends to find all my friends
> and then I could loop through the friends to get each friend's messages
> to place them in some array of messages I guess.
>
> But, is there a simpler way to get that list of messages?
>
> (I'm using has_many_friends plugin btw)
>
> Thanks.
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to