# IKEA Foundation - Week 2026 Project This project is a Ruby on Rails application developed for the IKEA Foundation. It is a multi-lingual, interactive game/educational tool where players progress through various stages, making choices or facing "chance" events. ## Key Features - **Multi-lingual Support:** Uses the `mobility` gem for translating content into numerous languages. Supported locales include: en, zh, hr, cs, da, nl, fi, fr, fr-CA, de, hu, it, ja, ko, nb, pl, pt, ro, sr, sk, sl, es, sv, uk. - **Hierarchical Content Management:** A "Node" system (using `ancestry`) for managing pages, stages, and interactive elements. - **Player Progression:** Tracks player progress, scores, and decisions across different stages in the `Player` model's `progress` JSONB field. - **Interactive Game Flow:** Managed by `StagesController`, featuring: - **Flip:** Randomly determines if a stage is a "chance" or "choice" event. - **Reveal:** Displays the specific content for the flipped event. - **Pick:** For "chance", randomly samples an outcome; for "choice", records the player's selection. - **Result:** Shows the outcome (e.g., best, bad, good, game_over) based on the previous step. - **Admin Interface:** A backend for managing nodes, assets (Active Storage), users, and translations. - **Search:** `pg_search` integration for content discovery. ## Technical Stack - **Framework:** Ruby on Rails 8.1.2 - **Language:** Ruby 3.4.9 - **Database:** PostgreSQL - **Asset Pipeline:** Propshaft with Importmap-rails and Stimulus/Turbo. - **Background Jobs:** Sidekiq with Redis. ## Core Models - `Node`: The central content model. Templates are hierarchy-dependent: - **Root (Depth 0):** `start` - **Level 1:** `stage` - **Level 2:** `choice`, `chance` - **Level 3 (under choice/chance):** `best`, `bad`, `good`, `game_over` - `Player`: Tracks session state, `progress`, `current_stage`, and `score`. - `Asset` & `Attachment`: Handles media and its contextual content (body text, styling) associated with nodes. - `User`: Admin authentication and roles. ## Project Structure - `app/controllers/admin/`: Admin backend logic. - `app/controllers/stages_controller.rb`: Main game loop (Flip -> Reveal -> Pick -> Result). - `app/controllers/site_controller.rb`: Content delivery for standard pages. - `app/models/concerns/`: Shared logic for ancestry, attachments, and tags. - `config/locales/`: YAML translation files.