在這裏你去,你可以寫,每當創建問題添加默認的問題進行遷移,
class ChangeDefaultQuestions < ActiveRecord::Migration
def self.up
change_column :questions, :question_one, :string, :default => 'What is your name?'
change_column :questions, :question_two, :string, :default => 'How old are you?'
change_column :questions, :question_three, :string, :default => 'Where do you live'
# to add default questions to previously created questions
Questions.update_all({ :question_one => 'your qestion', :question_two => 'your question', :question_three => 'your question' })
end
def self.down
change_column :movies, :rating, :string, :default => nil
Questions.update_all({ :question_one => '', :question_two => '', :question_three => '' })
end
end
我相信當創建新的用戶會回答你的問題