app/controllers/rostra/answers_controller.rb in rostra-0.0.3 vs app/controllers/rostra/answers_controller.rb in rostra-0.0.4

- old
+ new

@@ -2,17 +2,10 @@ class AnswersController < ApplicationController load_and_authorize_resource before_filter :fetch_question def vote - if current_user.voted_for?(@answer) && params[:vote_type] == 'up' - current_user.clear_votes(@answer) - elsif current_user.voted_against?(@answer) && params[:vote_type] == 'down' - current_user.clear_votes(@answer) - else - current_user.vote_exclusively_for(@answer) if params[:vote_type] == 'up' - current_user.vote_exclusively_against(@answer) if params[:vote_type] == 'down' - end + rostra_user.vote_on(@answer, params[:vote_direction]) respond_to do |format| format.html { redirect_to question_path(@question, anchor: "rostra_answer_#{@answer.id}") } format.js end