diff --git a/app/controllers/break_escape/application_controller.rb b/app/controllers/break_escape/application_controller.rb index 4ada373..c3703e8 100644 --- a/app/controllers/break_escape/application_controller.rb +++ b/app/controllers/break_escape/application_controller.rb @@ -7,8 +7,8 @@ module BreakEscape # Helper method to get current player (polymorphic) def current_player - if BreakEscape.standalone_mode? - # Standalone mode - get/create demo user + if BreakEscape.standalone_mode? || !respond_to?(:current_user, true) + # Standalone mode or no current_user available - get/create demo user @current_player ||= DemoUser.first_or_create!(handle: 'demo_player') else # Mounted mode - use Hacktivity's current_user diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 6e61f6b..46ba10e 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -18,6 +18,9 @@ module Dummy # Common ones are `templates`, `generators`, or `middleware`, for example. config.autoload_lib(ignore: %w[assets tasks]) + # Load engine migrations + config.paths['db/migrate'] << File.expand_path('../../../../db/migrate', __dir__) + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb index 9bf62f3..835baac 100644 --- a/test/dummy/config/routes.rb +++ b/test/dummy/config/routes.rb @@ -1,3 +1,6 @@ Rails.application.routes.draw do mount BreakEscape::Engine => "/break_escape" + + # Redirect root to missions list + root to: redirect('/break_escape/missions') end diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 52bf4c0..2f775c7 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -10,26 +10,26 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2025_11_20_160000) do +ActiveRecord::Schema[7.2].define(version: 2025_11_20_160000) do create_table "break_escape_demo_users", force: :cascade do |t| - t.datetime "created_at", null: false t.string "handle", null: false t.string "role", default: "user", null: false + t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["handle"], name: "index_break_escape_demo_users_on_handle", unique: true end create_table "break_escape_games", force: :cascade do |t| - t.datetime "completed_at" - t.datetime "created_at", null: false - t.integer "mission_id", null: false - t.integer "player_id", null: false - t.json "player_state", default: "{\"currentRoom\":null,\"unlockedRooms\":[],\"unlockedObjects\":[],\"inventory\":[],\"encounteredNPCs\":[],\"globalVariables\":{},\"biometricSamples\":[],\"biometricUnlocks\":[],\"bluetoothDevices\":[],\"notes\":[],\"health\":100}", null: false t.string "player_type", null: false + t.integer "player_id", null: false + t.integer "mission_id", null: false t.json "scenario_data", null: false - t.integer "score", default: 0, null: false - t.datetime "started_at" + t.json "player_state", default: "{\"currentRoom\":null,\"unlockedRooms\":[],\"unlockedObjects\":[],\"inventory\":[],\"encounteredNPCs\":[],\"globalVariables\":{},\"biometricSamples\":[],\"biometricUnlocks\":[],\"bluetoothDevices\":[],\"notes\":[],\"health\":100}", null: false t.string "status", default: "in_progress", null: false + t.datetime "started_at" + t.datetime "completed_at" + t.integer "score", default: 0, null: false + t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["mission_id"], name: "index_break_escape_games_on_mission_id" t.index ["player_type", "player_id", "mission_id"], name: "index_games_on_player_and_mission", unique: true @@ -38,12 +38,12 @@ ActiveRecord::Schema[8.1].define(version: 2025_11_20_160000) do end create_table "break_escape_missions", force: :cascade do |t| - t.datetime "created_at", null: false - t.text "description" - t.integer "difficulty_level", default: 1, null: false - t.string "display_name", null: false t.string "name", null: false + t.string "display_name", null: false + t.text "description" t.boolean "published", default: false, null: false + t.integer "difficulty_level", default: 1, null: false + t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["name"], name: "index_break_escape_missions_on_name", unique: true t.index ["published"], name: "index_break_escape_missions_on_published" diff --git a/test/dummy/storage/test.sqlite3 b/test/dummy/storage/test.sqlite3 index 500ee2f..b4f7039 100644 Binary files a/test/dummy/storage/test.sqlite3 and b/test/dummy/storage/test.sqlite3 differ