- Build a database-backed Ruby application using Active Record
- Design and interact with data models using object-oriented Ruby
- Implement a multi-class CLI frontend
- Practice working with migrations, associations, and validations
Congrats on getting through all the material for Phase 3! You've learned how to work with databases, design models with Active Record, and write object-oriented Ruby. Now it's time to bring those skills together into a full project.
This project will focus on building a Ruby command-line application that reads from and writes to a local SQLite3 database using Active Record — no web server required.
By the end of the project, you'll have a functioning CLI that lets users interact with your data by creating, viewing, updating, and deleting records from the terminal.
- At least two model classes using
ActiveRecord::Base - A one-to-many relationship (
has_many/belongs_to) - At least one model with validations
- Display associated data where appropriate (e.g. listing a parent record's associated children)
- At least two Ruby classes (e.g. a
Menuclass and a model-specific helper) - A loop or menu interface
- Ability to create, view, update, and delete records
- Update prompts should display the current value before asking for a new one
- Plan out your features
- Develop user stories
- "As [ a user ], I want [ to perform this action ] so that [ I can accomplish this goal ]."
- Features should not need you there to explain them to users
- Create a
user-stories.mdfile and add your user stories there
Before you start working on your project, you'll pitch your project idea to your instructors for approval and feedback.
For your project pitch, you should include:
- The basic story of your application
- The core features of your MVP
- The data you plan to persist and how you will structure it
- Challenges you expect to face
- How you are meeting the requirements of the project
MVP ASAP — Focus on getting your minimum viable product working first!
You could build a Book Tracker app:
Authorhas manyBooks- Users can:
- Create a new book
- List all books
- Update book details
- Delete a book
- View books by a specific author
Or a Workout Log:
WorkoutSessionhas manyExercises- Users can:
- Log a new workout
- Add exercises
- Update reps/weights
- View or delete past workouts
Fork and clone this repository to get started.
Install dependencies:
bundle installCreate and migrate the database:
bundle exec rake db:create
bundle exec rake db:migrateOptionally seed the database with starter data:
bundle exec rake seedRun your CLI application:
ruby cli/main.rbOpen a Pry console with your models loaded:
bundle exec rake consoleGenerate a new migration:
bundle exec rake db:create_migration NAME=create_books├── app/
│ └── models/ # Your Active Record model classes go here
├── cli/
│ └── main.rb # Entry point — your CLI menu lives here
├── config/
│ └── environment.rb # Loads gems, DB connection, and models
├── db/
│ ├── config.yml # Database connection settings
│ ├── migrate/ # Migration files
│ └── seeds.rb # Seed data
└── spec/ # RSpec tests (optional)
- Sketch your domain model first using dbdiagram.io
- Use
bundle exec rake consoleto test your models before building the CLI - Use
binding.pryfor debugging - Use
putsandppor gems liketty-tablefor formatted CLI output
A complete implementation is available on the sample-project branch. It demonstrates:
- Pet Tracker domain with Owners and Pets
- Full CRUD with Active Record and a clean menu-driven CLI
- Object-oriented design with user-friendly output
- All required features including current value prompts for updates
To view the sample:
git checkout sample-projectSee SAMPLE_PROJECT_README.md for detailed documentation.