Skip to content

Instantly share code, notes, and snippets.

@samuelkobe
Created September 17, 2012 22:43
Show Gist options
  • Save samuelkobe/3740239 to your computer and use it in GitHub Desktop.
Save samuelkobe/3740239 to your computer and use it in GitHub Desktop.
class HairstylesController < ApplicationController
before_filter :ip_check, :only => [:vote]
def vote
if @hairstyle = Hairstyle.find(params[:id])
@hairstyle.increment('count')
@hairstyle.save
redirect_to root_url, notice: 'Thanks for Voting'
end
end
private
def ip_check
redirect_to :action => 'vote', :id => params[:id]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment