Created
May 7, 2011 22:26
-
-
Save marcamillion/960909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UploadsController < ApplicationController | |
filter_resource_access | |
def vote_up | |
begin | |
current_user.vote_exclusively_for(@upload = Upload.find(params[:id])) | |
render :nothing => true, :status => 200 | |
rescue ActiveRecord::RecordInvalid | |
render :nothing => true, :status => 404 | |
end | |
end | |
def vote_down | |
begin | |
current_user.vote_exclusively_against(@upload = Upload.find(params[:id])) | |
render :nothing => true, :status => 200 | |
rescue ActiveRecord::RecordInvalid | |
render :nothing => true, :status => 404 | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment