Skip to content

Deprecate #where_* join query methods #1088

@akadusei

Description

@akadusei

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarify apiRename/remove/add something to make the API easier to understand

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions