I have an user array like this:
users_array = [[1,text for 1],[2,text for 2],[3,text for 3],[4,text for 4],[5,text for 5]]
here first element is user_id and second element is text which is specific to user_id in the same array.
Now I am trying to have user object from instead of ids in array like these.
users_array = [[#<User id: 1, encrypted_email: "">,text for 1],[#<User id: 2, encrypted_email: "">,text for 2],[#<User id: 3, encrypted_email: "">,text for 3],[#<User id: 4, encrypted_email: "">,text for 4],[#<User id: 5, encrypted_email: "">,text for 5]]
I am trying not to loop the array and hit the db thousand times for thousands user.
Aucun commentaire:
Enregistrer un commentaire