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

Add create_or_find_by to save_bang.rb #102

Merged
merged 2 commits into from Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,7 @@

* [#98](https://github.com/rubocop-hq/rubocop-rails/pull/98): Mark `Rails/ActiveRecordAliases` as `SafeAutoCorrect` false and disable autocorrect by default. ([@prathamesh-sonpatki][])
* [#101](https://github.com/rubocop-hq/rubocop-rails/pull/101): Mark `Rails/SaveBang` as `SafeAutoCorrect` false and disable autocorrect by default. ([@prathamesh-sonpatki][])
* [#102](https://github.com/rubocop-hq/rubocop-rails/pull/102): Include `create_or_find_by` in `Rails/SaveBang` cop. ([@MaximeLaurenty][])

MaximeLaurenty marked this conversation as resolved.
Show resolved Hide resolved
## 2.2.1 (2019-07-13)

Expand Down Expand Up @@ -60,3 +61,4 @@
[@brunvez]: https://github.com/brunvez
[@santib]: https://github.com/santib
[@prathamesh-sonpatki]: https://github.com/prathamesh-sonpatki
[@MaximeLaurenty]: https://github.com/MaximeLaurenty
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/save_bang.rb
Expand Up @@ -108,7 +108,7 @@ class SaveBang < Cop
CREATE_CONDITIONAL_MSG = '`%<current>s` returns a model which is ' \
'always truthy.'

CREATE_PERSIST_METHODS = %i[create
CREATE_PERSIST_METHODS = %i[create create_or_find_by
first_or_create find_or_create_by].freeze
MODIFY_PERSIST_METHODS = %i[save
update update_attributes destroy].freeze
Expand Down