logo       

[Rails] Re: how to give the condition between Id field and name field: msg#03246

RubyonRailsTalk

Subject: [Rails] Re: how to give the condition between Id field and name field


If your table looked like:
question_id
nominee_id
vote_count

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
controller.
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise