On Jul 3, 10:57 am, Scott LaBounty <slabou...@gmail.com> wrote:
> I'm messing around with a poll of the day site (another example for my blog)
> and am running across an issue where I'm not sure the best way to solve it.
> I have a Poll table that has a Title, Question, Date and each of these can
> have many reponses. So I create the polls and then display one with radio
> buttons for selecting. When the user makes a selection and "votes" I want to
> add one to the response's count. I have the Poll and can loop through its
> reponses and compare with the response I get back from the user but was
> wondering if there's an easier/better way to do it.
>
> If this isn't clear enough, let me know and I'll try to explain better.

Have the radio button return the response's id, and just look up the
response directly (make sure that the response's poll_id matches as
well).  Here's some (probably too) simple code:

  DB[:responses][:id=>params[:reponse_id], :poll_id=>params[:poll_id]]
= {:count=>:count+1}

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

Reply via email to