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

Make lock_nodes_between use #450

Closed
wants to merge 1 commit into from

Conversation

p8
Copy link
Contributor

@p8 p8 commented May 19, 2021

In 6c5040c Rails warnings were fixed.

It changed the implementation of lock_nodes_between from:

instance_base_class. ...

to the following:

instance_base_class.default_scoped. ...

To check if these implementations are similar we can add a check to
lock_nodes_between. If we add the following line to
lock_nodes_between we can compare the resulting SQL for both
implementations:

raise if instance_base_class.default_scoped.right_of(left_bound).left_of_right_side(right_bound).to_sql != instance_base_class.right_of(left_bound).left_of_right_side(right_bound).to_sql

Adding this check makes a spec fail.
Changing the check to use unscoped instead doesn't makes the
specs fail.

So changing the implementation to only use unscoped makes sure
the resulting SQL is similar to how it was before
6c5040c.

In 6c5040c Rails warnings were fixed.

It changed the implementation of `lock_nodes_between` from:

    instance_base_class. ...

to the following:

    instance_base_class.default_scoped. ...

To check if these implementations are similar we can add a check to
`lock_nodes_between`. If we add the following line to
`lock_nodes_between` we can compare the resulting SQL for both
implementations:

    raise if instance_base_class.default_scoped.right_of(left_bound).left_of_right_side(right_bound).to_sql != instance_base_class.right_of(left_bound).left_of_right_side(right_bound).to_sql

Adding this check makes a spec fail.
Changing the check to use `unscoped` instead doesn't makes the
specs fail.

So changing the implementation to only use `unscoped` makes sure
the resulting SQL is similar to how it was before
6c5040c.
@p8 p8 marked this pull request as draft May 19, 2021 17:48
@p8 p8 closed this May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant