mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
15 lines
395 B
Ruby
15 lines
395 B
Ruby
class GenerateUsername < ActiveRecord::Migration
|
|
class TempUser < ActiveRecord::Base
|
|
self.table_name = 'users'
|
|
end
|
|
|
|
def change
|
|
TempUser.all.each do |user|
|
|
if user.username.blank?
|
|
username = user.email.split('@')[0]
|
|
username += user.id.to_s if TempUser.find_by(username: username)
|
|
user.update_attributes(username: username)
|
|
end
|
|
end
|
|
end
|
|
end
|