14 lines
338 B
Ruby
14 lines
338 B
Ruby
|
class AddAuthority < ActiveRecord::Migration
|
||
|
def change
|
||
|
# 添加课程权限
|
||
|
Role.all.each do |role|
|
||
|
if role.name == '学生'
|
||
|
role.permissions.append(:paret_in_homework)
|
||
|
elsif role.name == 'Manager'
|
||
|
role.permissions.append(:is_manager)
|
||
|
end
|
||
|
role.save(:validate => false)
|
||
|
end
|
||
|
end
|
||
|
end
|