mirror of
https://github.com/internetee/registry.git
synced 2025-07-19 17:25:57 +02:00
Migration fix
This commit is contained in:
parent
508b822d3f
commit
ef75de17d4
1 changed files with 5 additions and 2 deletions
|
@ -3,8 +3,11 @@ class RefactorRoles < ActiveRecord::Migration
|
|||
add_column :users, :roles, :string, array: true
|
||||
|
||||
User.all.each do |x|
|
||||
x.roles = [x.role.code]
|
||||
x.save
|
||||
c = x.role.try(:code)
|
||||
if c
|
||||
x.roles = [c]
|
||||
x.save
|
||||
end
|
||||
end
|
||||
|
||||
remove_column :users, :role_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue