これで、質問が作成されるたびにデフォルトの質問を追加する移行を作成できます。
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
私はそれがあなたの質問に答えると確信しています