I'm creating my first rails app, a glossary app, which has three main models: Language, Glossary and Word.
The Word.rb holds the words created by users and contains the following attributes: id, word, transcription, translation, glossary_id, language_id
What I wanna do is to collect these words within the particular glossary, for instance "English", and create in-app quiz for testing words, which belong to this glossary.
But I stuck at this very moment...
The quiz is going to contain a number of questions(words to repeat) chosen by the users, but mustn't exceed the actual number of words in the glossary. A question page will have a question itself and 4 variants of answers, each question should be displayed on a separate page.
The Question page will follow this pattern, I suppose:
<%= @glossary.words.each do |word| %>
<h1>What's the translation for <%= word.word %>?</h1>
<%= @words.each do |word| %>
<ol><li><p><%= word.translation %></p></li></ol>
<% end %>
<% end %>
But I can't understand how to assign the correct answer, as well as, how to make the words within the answers section to be random on every single question and of course how to create per page question view with the progress bar of the test.
I appreciate any help! Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire