Skip to content

Rails/WhereEquals cop report offenses with not equivalent auto correction code for database name contained where query since 2.26.0 #1340

Closed
@r-plus

Description

Expected behavior

Redshift::User.where('mysql.users.status = ?', 1)

not report offenses for this code that contains where clause database_name.table_name.column_name style query.
That is rubocop-rails v2.25.1 behavior.

NOTE: This query is a query to mysql via Redshift using Redshift Federated Query.

Actual behavior

$ bundle exec rubocop test.rb
Inspecting 1 file
C

Offenses:

test.rb:1:16: C: [Correctable] Rails/WhereEquals: Use where(mysql: { users: 1 }) instead of manually constructing SQL.
Redshift::User.where('mysql.users.status = ?', 1)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected, 1 offense autocorrectable

report offense with not equivalent auto correction code.

Steps to reproduce the problem

  • Create file with Redshift::User.where('mysql.users.status = ?', 1)
  • run rubocop with rubocop-rails

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:
You can see extension cop versions (e.g. rubocop-rails, rubocop-performance, and others) output by rubocop -V,
include them as well. Here's an example:

$ be rubocop -V
1.65.1 (using Parser 3.3.4.2, rubocop-ast 1.32.1, running on ruby 3.3.4) [arm64-darwin23]
  - rubocop-capybara 2.21.0
  - rubocop-erb 0.5.3
  - rubocop-factory_bot 2.26.1
  - rubocop-graphql 1.5.4
  - rubocop-performance 1.21.1
  - rubocop-rails 2.26.0
  - rubocop-rspec 3.0.4
  - rubocop-rspec_rails 2.30.0
  - rubocop-slim 0.2.7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions