comparing ip adres with database list

How about something like (code can be made shorter, but I’ll keep it nice and easy to understand):

if Vote.find(:first, :conditions => [“ip_address = ? and poll_id = ?”, request.remote_ip, params[:poll_id]])

flash[:notice] = “You’ve voted for this poll already”

Do a redirect, reder or render something using AJAX


new_vote =[:vote])

new_vote.ip_address = request.remote_ip

assigned_poll = Poll.find(params[:poll_id])

assigned_poll << new_vote if assigned_poll && new_vote.valid?

Do a redirect, render or render something using AJAX


Best regards

Peter De Berdt