Topic: multiple users id

I am building a messages model.
In my model i have a user_id (for whom the message is for)
but some one else could pick up the message so i added a pickup_user_id

now when i do

Message.last.user

i get all the user info

but how can i map pickup_user_id  to the same way. so i can go

Message.last.pickup_user

and get the user info?

thanks

Re: multiple users id

May be by using polymorphic associations: http://guides.rubyonrails.org/associati … ociations.
In this case, your message would be 'pickable' or smth like that, i.e. it could be îcked up by one..to..many users.
Another way is to use an intermediate table/model, it depends if you want to have a relation like many-to-many between users and messages.

Re: multiple users id

Thanks.
I will read that guide.

What i did was something that i did not like as that was in the view i had

user = User.find(message.last.pickup_user)

but i am sure what i am going to read now is better