I have this use case.
Project:
has_many :assignments
Assignment:
has_many :assignments_users, class_name: "AssignmentsUsers"
has_many :assignees, through: :assignments_users, source: :user
assignments_users: is simply user_id and assignment_id.
I'd like to be able to do something like this.
projects = Project.includes(:assignments, {assignments: :assginments_users}).where("assignments.assignments_users.user_id = 6")
Where if I was to access assignments from a given project in the list, I would only see assignments where one of the users assigned is a user with id 6.
is this even do able?
I was thinking maybe I make an extra has_many my_assignments, (user_id) -> { where(match_something_to_my_user_id) }
is that even possible?