Skip to content

Instantly share code, notes, and snippets.

@hlxwell
Created June 15, 2014 09:25
Show Gist options
  • Save hlxwell/f1e0084d1cb5517d86a5 to your computer and use it in GitHub Desktop.
Save hlxwell/f1e0084d1cb5517d86a5 to your computer and use it in GitHub Desktop.
Get Primebook book questions
Book.all.each do |book|
next if !book.pages.any? {|p| p.questions.count > 0}
puts "============ #{book.name} ==============="
book.pages.each do |page|
next if page.questions.count == 0
puts " Page##{page.page_number}"
page.questions.each do |question|
puts " * Question: #{question.content}"
question.question_options.each do |option|
puts " - #{option.content} #{"√" if option.is_correct_answer}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment