responds with ajax to debate vote [#47]

This commit is contained in:
rgarcia
2015-07-28 20:52:59 +02:00
parent be2a481cd7
commit bdcd513f26
4 changed files with 29 additions and 24 deletions

View File

@@ -1,11 +1,12 @@
class VotesController < ApplicationController
before_action :set_debate
before_action :authenticate_user!
respond_to :html, :js
def create
register_vote
notice = @debate.vote_registered? ? I18n.t("votes.notice_thanks") : I18n.t("votes.notice_already_registered")
redirect_to @debate, notice: notice
respond_with @debate
end
private