A clean and modern Ruby on Rails web application for managing and discovering movies. Users can create, edit, delete, filter, and sort movies with ease. Built with a beautiful, responsive user interface.
- ✅ Create Movies - Add new movies with title, rating (0-5), description, and release date
- 📋 View All Movies - Browse all movies in a visually organized card layout
- 🔍 Search by Rating - Filter movies by rating (0 to 5 stars)
- 📊 Sort Movies - Sort by title, rating, or release date (ascending/descending)
- ✏️ Edit Movies - Update movie information with pre-filled forms
- 🗑️ Delete Movies - Remove movies with confirmation dialog
- 🎨 Beautiful UI - Clean, modern, responsive interface with smooth animations
- 💬 Flash Messages - Success and error notifications with animations
- 🔒 Data Validation - Prevents empty fields, duplicates, and invalid ratings
- 🧪 BDD Testing - Cucumber + Capybara for behavior-driven development (NEW!)
- 🔎 TMDb Search - Search for movies in The Movie Database (NEW!)
This project includes BDD tests with Cucumber covering the following behaviors:
- TMDb search sad path (movie not found)
- Adding and sorting movies by title (imperative and declarative)
- Filtering movies by selected ratings
- Sorting movies by release date
Full documentation, scenario descriptions, step definitions reference, and run commands:
- 📄 BDD.md - BDD documentation and instructions
Run all scenarios with:
bundle exec cucumberThis project implements a complete CRUD (Create, Read, Update, Delete) system:
- CREATE ✅ - Users can create new movies with validation
- READ ✅ - Users can view all movies and individual movie details
- UPDATE ✅ - Users can edit existing movies with pre-filled forms
- DELETE ✅ - Users can remove movies with confirmation dialogs
- Ruby: 3.0.2
- Rails: 7.1.6
- Database: SQLite3
- Frontend: HTML5, CSS3, JavaScript (Turbo)
- UI: Responsive design with gradients and animations
- Ruby 3.0.2 or higher
- Rails 7.1.6
- SQLite3
- Bundler
- Node.js (for asset compilation)
git clone https://github.com/anaareiis/My-Rotten-Potatoes
cd myrottenpotatoes# Install Ruby gems
bundle install
# Install JavaScript dependencies (if needed)
bundle exec rails javascript:install:esbuild
bundle exec rails css:install:bootstrap# Create and migrate the database
bundle exec rails db:create
bundle exec rails db:migrate
# (Optional) Load sample data
bundle exec rails db:seedStart the Rails server:
bundle exec rails serverOr use the shorter command:
rails sThe application will be available at: http://localhost:3000
For automatic asset recompilation during development:
./bin/dev- Navigate to the home page:
http://localhost:3000 - All movies are displayed as cards with:
- Movie title
- Rating (⭐ 0-5 stars)
- Description preview
- Release date
- Click the "➕ Add New Movie" button
- Fill in the form:
- Title - Movie name (required, must be unique)
- Rating - Select 0-5 stars (required, integer only)
- Description - Plot or details (required)
- Release Date - Use the date picker (required)
- Click "💾 Save Movie"
- A success message appears and you're redirected to the movie list
- Use the "Filter by Rating" dropdown
- Select a rating (0-5 stars) or "All Ratings"
- Click "Apply Filters"
- Only movies with that rating will be displayed
- Use the "Sort by" dropdown with options:
- Newest First (default)
- Title (A-Z / Z-A)
- Rating (High to Low / Low to High)
- Release Date (Newest / Oldest)
- Click "Apply Filters"
- Movies will be reordered accordingly
- Use both dropdowns together
- Click "Apply Filters" to apply both simultaneously
- Your selections are preserved in the URL
- Click on any movie title from the list
- View the complete movie information:
- Full description
- Exact rating
- Release date
- Available actions:
- ✏️ Edit - Modify movie information
- 🗑️ Delete - Remove the movie (with confirmation)
- ↩️ Back to Movies - Return to the list
- From the movie detail page, click "✏️ Edit"
- The form is pre-filled with current information
- Update any fields as needed
- Click "💾 Update Movie"
- Success message displays and you return to the movie list
- From the movie detail page, click "🗑️ Delete"
- Confirm the deletion when prompted
- Movie is removed and you return to the list
- Success message confirms the deletion
The application includes comprehensive validation to ensure data integrity:
-
Title:
- Required, must be unique (case-insensitive)
- Length: 2-200 characters
- Shows friendly error if duplicate
-
Rating:
- Required
- Must be an integer (no decimals)
- Range: 0-5 stars only
- Clear error message: "must be an integer between 0 and 5"
-
Description:
- Required
- Length: 10-1000 characters
- Shows error if too short or too long
-
Release Date:
- Required
- Cannot be in the future
- Cannot be before 1800
- Validates reasonable date range
- required attributes - Prevents form submission with empty fields
- minlength/maxlength - Browser enforces character limits
- date input with max - Prevents selecting future dates
- Character counter - Real-time feedback (10-1000 characters)
- Visual indicators - Color changes based on character count:
- 🔴 Red: Too few characters (< 10)
- 🟢 Green: Valid character count (10-900)
- 🟡 Yellow: Approaching limit (900-1000)
- Clear, descriptive error messages
- Error messages displayed in red box on form
- Full validation messages explain what's wrong
- Prevents invalid data from being saved
myrottenpotatoes/
├── app/
│ ├── controllers/
│ │ └── movies_controller.rb
│ ├── models/
│ │ └── movie.rb
│ └── views/
│ └── movies/
│ ├── index.html.erb
│ ├── new.html.erb
│ ├── edit.html.erb
│ └── show.html.erb
├── config/
│ ├── routes.rb
│ └── database.yml
├── db/
│ └── migrate/
├── README.md
└── Gemfile
bundle install --no-cache# Reset the database
bundle exec rails db:drop db:create db:migrate# Run on a different port
bundle exec rails server -p 3001bundle exec rails assets:precompile- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
This project is licensed under the MIT License.
Created with ❤️ by Ana Luísa Reis Nascente (211045688)
For issues, questions, or suggestions, please open an issue in the repository.