I'm trying to write an application where people can vote on things,
and I want to make sure a person can't vote twice. Pretend 'user' is
voting on various objects. I was thinking about something like this:
v = user.votes.find(:all, :select => 'object_id').
if v.contains?(object_a.id) then already_voted_a
if v.contains?(object_b.id) then already_voted_b
if v.contains?(object_c.id) then already_voted_c
But v won't be an array of object ids, it will be an array of votes,
right? How do you think I should go about doing this?
They're going to be many objects on a single page, so I only want to
do one database query.