修改contest表中budget字段的属性,将integer改为string

exceptionHandle
wanglinchun 12 years ago
parent 6b5452f3e2
commit 6afef880dc

@ -24,7 +24,7 @@ class Contest < ActiveRecord::Base
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :author_id, :name, :deadline
validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
# validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
validate :validate_user
after_create :act_as_activity

@ -1,10 +1,10 @@
class ChangeCreatedAtOfContestsToCreatedOn < ActiveRecord::Migration
def self.up
def up
rename_column :contests, :created_at, :created_on
rename_column :contests, :updated_at, :updated_on
end
def self.down
def down
rename_column :contests, :created_on, :created_at
rename_column :contests, :updated_on, :updated_at
end

@ -0,0 +1,10 @@
class RemoveBudgetFromContests < ActiveRecord::Migration
def self.up
change_column :contests, :budget, :string, :default => ""
end
def self.down
change_column :contests, :budget, :integer, :default => 0
end
end

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save