Sha256: 8c6656b87bff2a40a683a3ef39846f04ef922b75f84917cfc602f7e32b9ef927

Contents?: true

Size: 550 Bytes

Versions: 9

Compression:

Stored size: 550 Bytes

Contents

module Effective
  class PollsController < ApplicationController
    before_action(:authenticate_user!) if defined?(Devise)

    def show
      poll = Effective::Poll.find(params[:id])
      EffectivePolls.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
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
effective_polls-0.1.6 app/controllers/effective/polls_controller.rb
effective_polls-0.1.5 app/controllers/effective/polls_controller.rb
effective_polls-0.1.4 app/controllers/effective/polls_controller.rb
effective_polls-0.1.3 app/controllers/effective/polls_controller.rb
effective_polls-0.1.2 app/controllers/effective/polls_controller.rb
effective_polls-0.1.1 app/controllers/effective/polls_controller.rb
effective_polls-0.1.0 app/controllers/effective/polls_controller.rb
effective_polls-0.0.2 app/controllers/effective/polls_controller.rb
effective_polls-0.0.1 app/controllers/effective/polls_controller.rb