lib/tasks/db_seed_questions.rake
# Seed multiple questions by loading the YAML file
Seed multiple questions by loading the YAML file
Seed multiple questions by loading the YAML file
def db_seed_questions
  path = Rails.root.join('db','seeds','questions.yml')
  File.open(path) do |file|
    YAML.load_stream(file) do |doc|
      doc.keys.sort.each do |tag|
        attributes = doc[tag]
        db_seed_question(tag, attributes)
      end
    end
  end
end
def db_seed_questions path = Rails . root . join ( 'db' , 'seeds' , 'questions.yml' ) File . open ( path ) do | file | YAML . load_stream ( file ) do | doc | doc . keys . sort . each do | tag | attributes = doc [ tag ] db_seed_question ( tag , attributes ) end end end end
Seed multiple questions by loading the YAML file
Seed multiple questions by loading the YAML file
# puts "Seeding App Questions from #{path}" # puts "Seeding question with tag #{tag}"