New to seqeul and sql in general. I have two tables,
foreign_key :group_id, :groups
I would structure the SQL statement as below. Which would provide you the resources objects that are associated with a specific task id through the join table.
SELECT * FROM resources r JOIN groups_resources gr ON gr.resources_id = r.id JOIN groups g ON gr.group_id = g.id JOIN task t ON t.id = g.id WHERE t.id = ?