Class: RailsVoter::ElectionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsVoter::ElectionsController
- Defined in:
- app/controllers/rails_voter/elections_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/controllers/rails_voter/elections_controller.rb', line 19 def create if election.save redirect_to elections_path else render :new end end |
#new ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/rails_voter/elections_controller.rb', line 13 def new 10.times do election.election_details.new end end |
#update ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/rails_voter/elections_controller.rb', line 27 def update if election.update(election_params) redirect_to elections_path else render :new end end |