I have website which displays tweets (from twitter). Each tweet can
either be given thumbsup or thumbsdown, but only once. What would be
the best way to organzine a database table for this? Its a many-to-many
relationship between tweets and users - should I make a database, lets
call it ‘pairs’, so that each user will have_many :tweets through pairs?
I should have validation coming from two directions - when displaying
the tweet, it should check if the logged in user has already given the
tweet thumbsup/thumbsdown, and every time an opinion is given, it should
check if the tweet has already been reviewed by the logged in user.
I could see this database of pairs becoming very large, but fortunately
there’s really no reason to let users rate tweets after a certain date -
so I could make a periodic job that removes old entries from the table
after a week or so.
I’m sure that I could work out a solution on my own, but this is
somewhere I’d much rather be sure that I’m doing the right way, rather
than having to go back an change it later for performance or
maintainability reasons. Thanks in advance for any input!
PS - It would be nice to allow users without accounts to rate tweets. I
could store pair data in their session, but this would obviously not be
bulletproof. One big concern is if robots take advantage, rating 1000s
of times by clearing their sessions and such. Will be googling on this