I have these tables and relationships:
user has_many projects
project has_many tasks
task has_many actions
I would like to build a scope that allows me to select all of the current users actions, regardless of what project or task they belong to.
Thanks
I found something that works.
In the Actions model:
From the console:
I’m mot sure if its the best way to do it as I’m a bit new to sql. I get the feeling it could be made more concise.
EDIT Slightly better