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

Ignore empty condition on #construct_relation_for_exists #34329

Merged
merged 1 commit into from
Oct 27, 2018

Commits on Oct 27, 2018

  1. Ignore empty condition on #construct_relation_for_exists

    At rails@fc0e335,
    
    ```rb
    relation = relation.where(conditions)
    ```
    
    was rewritten to:
    
    ```rb
    relation.where!(condition)
    ```
    
    This change accidentally changed the result of `Topic.exists?({})` from true to false.
    
    To fix this regression, first I moved the blank check logic (`opts.blank?`) from `#where` to `#where!`,
    because I thought `#where!` should be identical to `#where`, except that instead of returning a new relation,
    it adds the condition to the existing relation.
    
    But on second thought after some discussion on rails#34329,
    I started to think that just fixing `#construct_relation_for_exists` is more preferable
    than changing `#where` and `#where!`.
    r7kamura committed Oct 27, 2018
    Configuration menu
    Copy the full SHA
    4694fcf View commit details
    Browse the repository at this point in the history