Show More
Commit Description:
MERGE changeset 306:307 from branch ytopc08-2 that fixes migration bug...
Commit Description:
MERGE changeset 306:307 from branch ytopc08-2 that fixes migration bug
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@308 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
db/migrate/20081204122651_add_activated_to_users.rb
| 25 lines
| 430 B
| text/x-ruby
| RubyLexer
|
|
r155 | class AddActivatedToUsers < ActiveRecord::Migration | ||
def self.up | ||||
add_column :users, :activated, :boolean, :default => 0 | ||||
|
r161 | User.reset_column_information | ||
|
r155 | User.find(:all).each do |user| | ||
|
r159 | |||
# disable validation | ||||
class <<user | ||||
def valid? | ||||
return true | ||||
end | ||||
end | ||||
|
r155 | user.activated = true | ||
user.save | ||||
end | ||||
end | ||||
def self.down | ||||
remove_column :users, :activated | ||||
end | ||||
end | ||||