johny kopparapu

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in How to model and integrate a rails mutliple choice quiz?

I am trying to make a little app where users can sign up, login, and be able to view and interact with questions for educational purposes.

I can visualize everything, but I'm having trouble translating that into actual code.

I know that a question model will have

Question Title - as a string or text

Question Answer 1 - as a string or text

Question Answer 2 - as a string or text

Question Answer 3 - as a string or text

Question Answer 4 - as a string or text

Question CORRECT ANSWER 5 - as a string or text

Naturally, I know the strong_params will have to accept these attributes (parameters?) as well.

How can I make a model where the new-question.html.erb form will pass an array of 5 options, with the ability to mark one as correct? On top of this, I would like to shuffle or randomize the answer choices on each page load.

Any help or guidance would be helpful. Michael Hartl's tutorial is great, but I'm not sure if i'm missing things from it or things aren't clicking.

Thank you @ Tekslate

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.