Rails app for ranking foods using the Elo rating system. You vote between two foods; winners gain rating, losers lose it. The leaderboard at /foods shows foods ordered by Elo.
- Vote: choose the winner; Elo updates for both foods and you’re sent to the next matchup.
- Leaderboard: view the full ranking at
/foods.
- Ruby 3.4.x (match
.ruby-version/DockerfileARG RUBY_VERSION) - Bundler
- PostgreSQL running and accessible per
config/database.yml
- Install gems
bundle install
- Create and migrate DB
bin/rails db:create db:migrate
- Seed data (expects JPG images in
app/assets/images)- Add
.jpgimages toapp/assets/images(filename becomes food name via titleize) bin/rails db:seed
- Add
-
Recommended (Procfile.dev via foreman):
bin/dev- Starts Rails on
http://localhost:3000and Tailwind watcher.
-
Alternatively:
bin/rails server- In another shell:
bin/rails tailwindcss:watch
Open:
/to start voting/foodsto see the leaderboard
- Seeds iterate
app/assets/imagesfor files ending in.jpg. - For each file
tacos.jpg, createsFood(name: "Tacos", image_filename: "tacos.jpg", elo: 1200)if missing.
-
Docker (production image)
- Build:
docker build -t elo_rank_us_food . - Run:
docker run -d -p 80:80 -e RAILS_MASTER_KEY=... --name elo_rank_us_food elo_rank_us_food - Image uses Thruster to run Rails on port 80 by default.
- Build:
-
Kamal
- Gem
kamalis included andconfig/deploy.ymlis present. Use Kamal if you prefer container‑based deploys to your servers.
- Gem
- GET / → random vote (
foods#random_edit) - GET /foods → leaderboard
- GET /foods/:id/edit → head‑to‑head vote
- PATCH /foods/:id → submit a vote (updates Elo and redirects)