I have these two tables
tickets – id, user_id, manager_id etc
users – id, first_name etc
user_id and manager_id are both references for users
using rails is there a way of creating a find that pulls in the users info and managers(users) info.
The sql joins would look abit like this –
LEFT JOIN users ON users.id = tickets.user_id
LEFT JOIN users as managers ON managers.id = tickets.manager_id
Expected result
ticket:
subject: something interesting
user_id: 1
manager_id: 3
user:
id: 1
name: Frank
manager:
id: 3
name: Alex
Thanks, Alex
If I understood you correctly, you should use something like:
Then you can use