changes from comments, fix commercials failing test
This commit is contained in:
parent
d794593e10
commit
beb88b848d
15 changed files with 58 additions and 77 deletions
|
|
@ -1,28 +0,0 @@
|
|||
class MigrateRolesForCanCan < ActiveRecord::Migration
|
||||
|
||||
def up
|
||||
# Store the number of existing roles
|
||||
old_roles = Role.count
|
||||
|
||||
Role.all.each do |role|
|
||||
role.users.each do |user|
|
||||
Conference.all.each do |conference|
|
||||
if role.name == 'Admin' || role.name == 'Organizer'
|
||||
user.add_role :organizer, conference
|
||||
else
|
||||
user.add_role role.name.parameterize.underscore.to_sym, conference
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete old roles
|
||||
Role.first(old_roles).each do |role|
|
||||
role.destroy
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration.new('Cannot reverse migration. Deleted events cannot be re-created')
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue