Files
danbooru/app/controllers/post_votes_controller.rb
2017-01-09 17:31:14 -08:00

19 lines
375 B
Ruby

class PostVotesController < ApplicationController
before_filter :voter_only
skip_before_filter :api_check
def create
@post = Post.find(params[:post_id])
@post.vote!(params[:score])
rescue PostVote::Error => x
@error = x
end
def destroy
@post = Post.find(params[:post_id])
@post.unvote!
rescue PostVote::Error => x
@error = x
end
end