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

Support combining scopes when loading records, use Arel instead of SQL #717

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Commits on Jun 21, 2021

  1. Configuration menu
    Copy the full SHA
    f372180 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2021

  1. Pass a AR::Relation into the ActiveRecord adapter

    This breaks all kinds of things for now, but will open up using the
    `accessible_by` on scopes.
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    f0282ce View commit details
    Browse the repository at this point in the history
  2. Drop support for Rails < 5.2

    Rails 5.1 has been EOL for a long while, and the code hoops we'd have to
    jump through to keep supporting it are really quite large.
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    79e22cc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6839d7d View commit details
    Browse the repository at this point in the history
  4. Use ActiveRecord to join conditions, not SQL

    This passes all the conditions we have into ActiveRecord's `where`
    method and joins them using `or` and leaves the SQL generation to
    ActiveRecord/Arel.
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    8ec84d6 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7bced0e View commit details
    Browse the repository at this point in the history
  6. Test generated SQL instead of conditions Array

    The conditions array is really an artefact of the old implementation and
    should IMO not be tested. Let's instead test where the rubber hits the
    road: Which database records are returned.
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    f9aecd5 View commit details
    Browse the repository at this point in the history
  7. Remove artefacts of SQL-based implementation

    Now that we're using ActiveRecord to generate and merge conditions, we
    do not need a lot of code any longer.
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    2d05908 View commit details
    Browse the repository at this point in the history
  8. Update documentation

    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    b0f0436 View commit details
    Browse the repository at this point in the history
  9. Satisfy Rubocop

    This extracts a lot of stuff into methods. I sure am hopeful this makes
    the code more readable!
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    4f8bc1c View commit details
    Browse the repository at this point in the history
  10. Do not use IDs as test scopes

    IDs have primary key constraints, and we cannot know when our test runs
    respective to other tests.
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    e281cd2 View commit details
    Browse the repository at this point in the history
  11. Fix failing Postgres spec

    Ok, so Postgres can't order by a column that's not on the select list.
    Let's put the column on the select list if that's what we want to order
    by!
    mamhoff committed Jun 28, 2021
    Configuration menu
    Copy the full SHA
    5c41c53 View commit details
    Browse the repository at this point in the history