Class: ScavengerHunt::GamesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ScavengerHunt::GamesController
- Defined in:
- lib/scavenger_hunt/app/controllers/scavenger_hunt/games_controller.rb
Instance Method Summary collapse
Instance Method Details
#finish ⇒ Object
5 6 7 8 9 10 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/games_controller.rb', line 5 def finish if params[:confirm] @game.update_attributes(ended_at: Time.now) redirect_to params[:confirm] == "skip" ? locations_path : finished_game_path(@game) end end |
#finished ⇒ Object
12 13 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/games_controller.rb', line 12 def finished end |
#new ⇒ Object
15 16 17 18 19 20 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/games_controller.rb', line 15 def new location = ScavengerHunt::Location.find(params[:location_id]) player = current_player || create_player! game = player.games.find_or_create_by!(location: location) redirect_to game.finished? ? finished_game_path(game) : game_path(game) end |
#show ⇒ Object
22 23 |
# File 'lib/scavenger_hunt/app/controllers/scavenger_hunt/games_controller.rb', line 22 def show end |