Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Ensure HABTM associations are not incorrectly labeled n+1 #581

Commits on Jun 14, 2021

  1. Bug: Ensure HABTM associations are not incorrectly labeled n+1

    Prior to this commit, unless your HABTM join table excluded the `id`
    primary key column, it would be erroneously marked as a potential n+1
    query. Other HABTM queries that had join tables _without_ an `id` column
    were properly ignored. This exclusion _seems_ to be a side-effect of
    excluding objects that don't have primary keys/id columns in an effort
    to ignore non-persisted objects (stemming from [this commit](https://github.com/flyerhzm/bullet/blob/2c8a6d26f4a11bc8b3af5ff7da815401049732d4/lib/bullet/detector/n_plus_one_query.rb#L37)).
    
    This commit, instead, explicitly ignores HABTM models when checking for potential
    objects that could have a n+1 impact since they are join tables that
    typically aren't queried for specifically but instead are joined on.
    tbro-evi committed Jun 14, 2021
    Copy the full SHA
    660a05a View commit details
    Browse the repository at this point in the history