I’m trying to do a really complex join with ActiveRecord and am coming
up pretty short so far.
The structure is like:
user
id
name
etc.
task
name
ect.
task_assignments
from_user_id
to_user_id
task_id
I’m not sure how to model it correctly. I checked out the has_many
:through post about doing self referential joins, but that’s for getting
a user from a user. I want to get the actual task_assignments from a
user:
Anyone have any insight into this? @user.task_assignments is a list of tasks, so you can’t do @user.task_assignments.task.name - how should the interpreter know
which task assignment (out of many) you want the task for?
You’ll have to iterate through the tasks in some way, for example to
collect all the names:
Anyone have any insight into this? @user.task_assignments is a list of tasks, so you can’t do @user.task_assignments.task.name - how should the interpreter know
which task assignment (out of many) you want the task for?
You’ll have to iterate through the tasks in some way, for example to
collect all the names: