This project is a Ruby on Rails application developed for the IKEA Foundation. It appears to be a multi-lingual, interactive game or educational tool ("Week 2026") where players progress through various stages, making choices or facing "chance" events.
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 (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).
- **Content Management:** A hierarchical "Node" system (using `ancestry`) for managing pages, stages, and interactive elements.
- **Player Progression:** Tracks player progress, scores, and decisions across different stages.
- **Interactive Stages:** Includes mechanics for "flipping" between "chance" and "choice" outcomes, sampling random results, and advancing through a sequence of stages.
- **Admin Interface:** A backend for managing nodes, assets (using Active Storage), users, and translations.
- **Background Jobs:** Uses `sidekiq` and `redis` for asynchronous processing.
- **Search:** Integrates `pg_search` for full-text search capabilities within the node/content system.
- **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
@ -18,21 +21,23 @@ This project is a Ruby on Rails application developed for the IKEA Foundation. I
- **Language:** Ruby 3.4.9
- **Database:** PostgreSQL
- **Asset Pipeline:** Propshaft with Importmap-rails and Stimulus/Turbo.
- **Task Management:** Sidekiq with Redis.
- **Styling/UI:** Custom CSS/JS (Stimulus controllers for interactivity).
- **Background Jobs:** Sidekiq with Redis.
## Core Models
- `Node`: The central model for content, representing pages, stages, and interactive components in a tree structure.
- `Player`: Represents a session/user playing the game, tracking their `progress`, `current_stage`, and `score`.
- `Asset`&`Attachment`: Manage files and their association with nodes.
- `User`: Handles admin authentication and roles.
- `VerificationCode`: Likely used for secure admin login or two-step authentication.
- `Node`: The central content model. Templates are hierarchy-dependent: