Skip to content

Commit 3902899

Browse files
MaximeLaurentykoic
authored andcommitted
Add create_or_find_by to save_bang.rb (#102)
1 parent 965cd51 commit 3902899

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

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

1819
## 2.2.1 (2019-07-13)
1920

@@ -60,3 +61,4 @@
6061
[@brunvez]: https://github.com/brunvez
6162
[@santib]: https://github.com/santib
6263
[@prathamesh-sonpatki]: https://github.com/prathamesh-sonpatki
64+
[@MaximeLaurenty]: https://github.com/MaximeLaurenty

lib/rubocop/cop/rails/save_bang.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class SaveBang < Cop
108108
CREATE_CONDITIONAL_MSG = '`%<current>s` returns a model which is ' \
109109
'always truthy.'
110110

111-
CREATE_PERSIST_METHODS = %i[create
111+
CREATE_PERSIST_METHODS = %i[create create_or_find_by
112112
first_or_create find_or_create_by].freeze
113113
MODIFY_PERSIST_METHODS = %i[save
114114
update update_attributes destroy].freeze

0 commit comments

Comments
 (0)