Class: ScavengerHunt::PlayersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ScavengerHunt::PlayersController
- Defined in:
- lib/scavenger_hunt/app/controllers/scavenger_hunt/players_controller.rb
Instance Method Summary collapse
- #create ⇒ Object (also: #update)
- #new ⇒ Object
- #show ⇒ Object
Instance Method Details
#create ⇒ Object Also known as: update
5 6 7 8 9 10 11 12 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/players_controller.rb', line 5 def create if @player.update_attributes(player_attributes) @player.games.active.update_all(ended_at: Time.now) redirect_to survey_questions_path else render :new end end |
#new ⇒ Object
15 16 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/players_controller.rb', line 15 def new end |
#show ⇒ Object
18 19 20 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/players_controller.rb', line 18 def show redirect_to new_player_path unless current_player? && current_player.name.present? end |