aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/controllers/voting_options_controller.rb')
-rw-r--r--site/app/controllers/voting_options_controller.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/site/app/controllers/voting_options_controller.rb b/site/app/controllers/voting_options_controller.rb
index 14ec89f..73a0dfb 100644
--- a/site/app/controllers/voting_options_controller.rb
+++ b/site/app/controllers/voting_options_controller.rb
@@ -6,7 +6,10 @@ class VotingOptionsController < ApplicationController
def community_vote
option = VotingOption.find(params[:id])
- unless option.nil?
+ if option.nil?
+ flash[:notice] = "No such voting option"
+ redirect_to :controller => :agendas, :action => :index
+ else
if current_user.signed_up?
Vote.vote_for_option(current_user, option, false)
flash[:notice] = "You voted for #{option.description}"
@@ -14,9 +17,6 @@ class VotingOptionsController < ApplicationController
flash[:notice] = "You must be logged in to vote"
end
redirect_to :controller => :agenda_items, :action => :show, :id => option.agenda_item_id
- else
- flash[:notice] = "No such voting option"
- redirect_to :controller => :agendas, :action => :index
end
end
end