mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
- Add MissionsController for scenario selection - Add GamesController with scenario/ink endpoints - Add JIT Ink compilation logic - Add API::GamesController for game state management - Configure routes with REST + API endpoints - Add authorization hooks (Pundit) - Add polymorphic player support (current_player helper)
25 lines
573 B
Ruby
25 lines
573 B
Ruby
module BreakEscape
|
|
class MissionsController < ApplicationController
|
|
def index
|
|
@missions = if defined?(Pundit)
|
|
policy_scope(Mission)
|
|
else
|
|
Mission.published
|
|
end
|
|
end
|
|
|
|
def show
|
|
@mission = Mission.find(params[:id])
|
|
authorize @mission if defined?(Pundit)
|
|
|
|
# Create or find game instance for current player
|
|
@game = Game.find_or_create_by!(
|
|
player: current_player,
|
|
mission: @mission
|
|
)
|
|
|
|
redirect_to game_path(@game)
|
|
end
|
|
end
|
|
end
|