Skip to content

Commit

Permalink
Make ActiveRecordAliases scope false
Browse files Browse the repository at this point in the history
We faced an issue where our custom `update_attributes` method call was changed to `update` but the method name remained same in the method definition.

```ruby
def update_attributes
end

update_attributes
```

```ruby
def update_attributes
end

update
```

So the cop is not safe for auto correct.
  • Loading branch information
prathamesh-sonpatki committed Jul 30, 2019
1 parent aedb97c commit 04e8000
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/default.yml
Expand Up @@ -31,6 +31,7 @@ Rails/ActiveRecordAliases:
Use `update!` instead of `update_attributes!`.
Enabled: true
VersionAdded: '0.53'
Safe: false

Rails/ActiveRecordOverride:
Description: >-
Expand Down
2 changes: 1 addition & 1 deletion manual/cops_rails.md
Expand Up @@ -51,7 +51,7 @@ Include | `app/controllers/**/*.rb` | Array

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
--- | --- | --- | --- | ---
Enabled | Yes | Yes | 0.53 | -
Enabled | No | Yes | 0.53 | -

Checks that ActiveRecord aliases are not used. The direct method names
are more clear and easier to read.
Expand Down

0 comments on commit 04e8000

Please sign in to comment.