Doing anything other than an inner join is verbose:
UserQuery.new.left_join_tasks.where_tasks(TaskQuery.new.title("Clean up notes"), auto_inner_join: false)
Ideally, calling #left_join_task should automatically disable auto inner join. The problem, though, is that nothing stops anyone from calling #where_tasks before calling #left_join_tasks:
UserQuery.new.where_tasks(TaskQuery.new.title("Clean up notes")).left_join_tasks
Looking at Avram::BaseQueryTemplate, we could add overload to the #*_join_* methods that accept the assoc_query. This way we can have queries like this:
UserQuery.new.left_join_tasks(TaskQuery.new.title("Clean up notes"))
If we insist on having where_tasks in there (probably because it reads nice?), we can make that the argument name:
UserQuery.new.left_join_tasks(where_tasks: TaskQuery.new.title("Clean up notes"))
What do you think?
Doing anything other than an inner join is verbose:
Ideally, calling
#left_join_taskshould automatically disable auto inner join. The problem, though, is that nothing stops anyone from calling#where_tasksbefore calling#left_join_tasks:Looking at
Avram::BaseQueryTemplate, we could add overload to the#*_join_*methods that accept theassoc_query. This way we can have queries like this:If we insist on having
where_tasksin there (probably because it reads nice?), we can make that the argument name:What do you think?