This project is an e-Commerce web application built using Ruby on Rails. The application allows users to register, create ads to sell products, and manage a shopping cart. Some of the core functionalities are already implemented, while others need to be completed.
- Ruby: 3.3.0
- Rails: 6.1.3
- Devise: For user authentication
- ActiveRecord: For database management
- Bootstrap: For frontend styling
- Clone the repository:
git clone https://github.com/hmaach/shop.git cd shop
- Install dependencies:
bundle install
- Update dependencies:
bundle update
- Set up the database:
rails db:migrate rails db:seed
- Start the server:
rails s
- Open the application in your browser at
http://localhost:3001
- Implement
registrations_controller.rb
inapp/controllers
- Configure Devise for user authentication
- Define methods:
sign_up_params
: Allowname
,email
,password
,password_confirmation
account_update_params
: Allowname
,email
,password
,password_confirmation
,current_password
- Implement
products_helper.rb
inapp/helpers
- Ensure only the creator of a product can edit or delete it
- Display the seller's name on each product listing
- Create a
Cart
model - Implement:
- Adding items to the cart
- Displaying the total cart value
- Removing individual items from the cart
- Clearing the cart completely
- Displaying cart status with a cart icon
- Displaying messages upon adding/removing items
- Implement
current_cart.rb
inapp/models/concerns/
to retain cart data for users before login
bundle install # Install dependencies
bundle update # Update gems
rails s # Start Rails server (default: port 3000)
rails db:migrate # Apply pending migrations
rails db:seed # Seed database with initial data
rails g scaffold Product brand:string model:string description:text condition:string finish:string title:string price:decimal --no-stylesheets --no-javascripts
rails g controller store index
rails generate uploader Image
rails g migration add_image_to_products image:string
rails db:migrate