fix migration version and updated old rails methods into rails migrations
This commit is contained in:
parent
6e276b2787
commit
4eb451b3bd
204 changed files with 206 additions and 206 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class GenerateUsername < ActiveRecord::Migration
|
||||
class GenerateUsername < ActiveRecord::Migration[4.2]
|
||||
class TempUser < ActiveRecord::Base
|
||||
self.table_name = 'users'
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@ class GenerateUsername < ActiveRecord::Migration
|
|||
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)
|
||||
user.update(username: username)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue