Class: PollParticipationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/poll_participations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/poll_participations_controller.rb', line 6

def create
  poll_participation = poll_service.vote(params[:post_id], params[:poll_answer_id])
  respond_to do |format|
    format.mobile { redirect_to stream_path }
    format.json { render json: poll_participation, :status => 201 }
  end
rescue ActiveRecord::RecordInvalid
  respond_to do |format|
    format.mobile { redirect_to stream_path }
    format.json { head :forbidden }
  end
end