On 4 Jan 2008, at 17:04, Joe Peck wrote:
>
> I have part of my code where I get an array full of user_ids, sort of
> like this:
>
> @user_ids = [1,3,44,5,6]
>
>
> Is there a way for me to do something like
> @the users = User.find_all_by_id(@user_ids)
That will do it (Or User.find(@user_ids), the difference is what
happens if not all of the users can be found)
Fred
>
>
> that will get all those users in one database call?
> --
> 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
> -~----------~----~----~----~------~----~------~--~---
>