If your table looked like:
Then a voting page could populate a droplist with the ids and names of
the nominees (the default should be something other than the first
nominee to reduce ‘laziness bias’ in the results). The user chooses an
entry and submits.
The controller then takes the post, grabs the question_id, selected
nominee id and updates the vote_count for that record.
You could go another route an populate a form with radiobuttons, one per
nominee, but you’ll need to read up on radiobuttons in forms for Rails
as you code is a bit more involved (you’ll be passing an array to the
form, and pulling the one ‘selected’ option out of that list in your
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.