Class: Effective::PollsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/effective/polls_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



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

def show
  poll = Effective::Poll.find(params[:id])

  EffectiveResources.authorize!(self, :show, poll)

  ballot = Effective::Ballot.where(poll: poll, user: current_user).first

  if ballot.present?
    redirect_to effective_polls.poll_ballot_build_path(poll, ballot, ballot.next_step)
  else
    redirect_to effective_polls.poll_ballot_build_path(poll, :new, :start)
  end
end