Description:
fix user migration problem regarding validation
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@304 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r159:0e3b65c5794e - - 1 file changed: 8 inserted, 0 deleted
@@ -1,11 +1,19 | |||
|
1 | 1 | class AddActivatedToUsers < ActiveRecord::Migration |
|
2 | 2 | def self.up |
|
3 | 3 | add_column :users, :activated, :boolean, :default => 0 |
|
4 | 4 | |
|
5 | 5 | User.find(:all).each do |user| |
|
6 | + | |
|
7 | + # disable validation | |
|
8 | + class <<user | |
|
9 | + def valid? | |
|
10 | + return true | |
|
11 | + end | |
|
12 | + end | |
|
13 | + | |
|
6 | 14 | user.activated = true |
|
7 | 15 | user.save |
|
8 | 16 | end |
|
9 | 17 | end |
|
10 | 18 | |
|
11 | 19 |
You need to be logged in to leave comments.
Login now