Files
BreakEscape/app/controllers/break_escape/missions_controller.rb
Z. Cliffe Schreuders f6c9ceb5e8 feat: Add controllers and routes
- 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)
2025-11-21 15:27:54 +00:00

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