Description:
fix migration & model link bug in migration version 10 git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@91 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r42:0dae6922a01b - - 1 file changed: 7 inserted, 0 deleted

@@ -1,18 +1,25
1 class AddAdminAndRoles < ActiveRecord::Migration
1 class AddAdminAndRoles < ActiveRecord::Migration
2 +
3 +
2 def self.up
4 def self.up
3 root = User.new(:login => 'root',
5 root = User.new(:login => 'root',
4 :full_name => 'Administrator',
6 :full_name => 'Administrator',
5 :alias => 'root')
7 :alias => 'root')
6 root.password = 'ioionrails';
8 root.password = 'ioionrails';
9 +
10 + class << root
11 + public :encrypt_new_password
12 + end
13 +
7 root.encrypt_new_password
14 root.encrypt_new_password
8
15
9 role = Role.create(:name => 'admin')
16 role = Role.create(:name => 'admin')
10 root.roles << role;
17 root.roles << role;
11 root.save
18 root.save
12
19
13 user_admin_right = Right.create(:name => 'user_admin',
20 user_admin_right = Right.create(:name => 'user_admin',
14 :controller => 'user_admin',
21 :controller => 'user_admin',
15 :action => 'all')
22 :action => 'all')
16 problem_admin_right = Right.create(:name=> 'problem_admin',
23 problem_admin_right = Right.create(:name=> 'problem_admin',
17 :controller => 'problems',
24 :controller => 'problems',
18 :action => 'all')
25 :action => 'all')
You need to be logged in to leave comments. Login now