Class: PollParticipationsController

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

Instance Method Summary collapse

Methods included from ApplicationHelper

#all_services_connected?, #bookmarklet, #changelog_url, #contacts_link, #jquery_include_tag, #magic_bookmarklet_link, #pod_name, #pod_version, #popover_with_close_html, #raw_bookmarklet, #timeago

Instance Method Details

#createObject


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

def create
  answer = PollAnswer.find(params[:poll_answer_id])
  poll_participation = current_user.participate_in_poll!(target, answer) if target
  respond_to do |format|
    format.html { redirect_to :back }
    format.mobile { redirect_to stream_path }
    format.json { render json: poll_participation, :status => 201 }
  end
rescue ActiveRecord::RecordInvalid
  respond_to do |format|
    format.html { redirect_to :back }
    format.mobile { redirect_to stream_path }
    format.json { render :nothing => true, :status => 403 }
  end
end