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 get all those users in one database call?
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 get all those users in one database call?
On 4 Jan 2008, at 17:04, Joe P. 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs