Class: GamesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/games_controller.rb

Instance Method Summary collapse

Instance Method Details

#demo_gameObject



19
20
21
# File 'app/controllers/games_controller.rb', line 19

def demo_game
  @game = Game.find(params[:id])
end

#indexObject

GET /games or /games.json



5
6
7
8
# File 'app/controllers/games_controller.rb', line 5

def index
  @games = Game.where("id != -1")
  @current_user = User.find(session[:user_id]) if session[:user_id]
end

#showObject



10
11
12
13
14
15
16
17
# File 'app/controllers/games_controller.rb', line 10

def show
  @game = Game.find(params[:id])
  begin
    redirect_to send(@game.game_path)
  rescue NoMethodError
    redirect_to games_path, alert: "Game path not found."
  end
end