Class: VotesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- VotesController
- Defined in:
- app/controllers/votes_controller.rb
Instance Method Summary collapse
- #login ⇒ Object
-
#proceed ⇒ Object
this is basically a state machine to take you through the form.
Instance Method Details
#login ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/votes_controller.rb', line 7 def login if @ballot.too_early_to_vote? flash[:error] = "This election doesn't start until #{@ballot.pretty_start_date}" redirect_to root_url elsif @ballot.too_late_to_vote? flash[:error] = "This election ended on #{@ballot.pretty_end_date}" redirect_to root_url else present @page end end |
#proceed ⇒ Object
this is basically a state machine to take you through the form
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/votes_controller.rb', line 20 def proceed case params[:commit] when /proceed/i then new # login -> new when /vote/i then confirm # new -> confirm when /back/i then back_to_new # confirm -> new when /confirm/i then create # confirm -> create else logger.error "VotesController#proceed was called with params[:commit]=#{params[:commit].inspect}" unspecified_error end end |