Add Style/SelfAssignment Rubocop cop
The cop enforces use of self assignment operator E.g. a=a+2 gets written as a+=2. Also the offenses listed in rubocop.todo.yml have been corrected automatically with the --auto-correct option. Fixes issue #1531
This commit is contained in:
parent
be72b9d02e
commit
cdf794ecbf
5 changed files with 7 additions and 13 deletions
|
|
@ -7,9 +7,7 @@ class GenerateUsername < ActiveRecord::Migration
|
|||
TempUser.all.each do |user|
|
||||
if user.username.blank?
|
||||
username = user.email.split('@')[0]
|
||||
if TempUser.find_by(username: username)
|
||||
username = username + user.id.to_s
|
||||
end
|
||||
username += user.id.to_s if TempUser.find_by(username: username)
|
||||
user.update_attributes(username: username)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue