Skip to content

This is the second project in the fifth module of the Microverse program. It is a web blog built using Ruby on Rails framework with PostgreSQL database.

License

Notifications You must be signed in to change notification settings

mahammad-mostafa/topics-blog

Repository files navigation

🏷️ Topics Blog

This is the second project of the fifth module in the Microverse program.
Check the below contents for further details about this project.

📗 Contents

📖 Description

This repository is about a user blog with posts & likes. User authentication is required first. Every post contains comments & likes. Each user displays (name / photo / bio) & number of his posts. Each post displays (title / text) & number of its comments & likes. Pagination through posts using kaminari gem. It is built using Rails framework with Ruby. The project is configured to use PostgreSQL database. Unit tests are carried on models & controller requests using RSpec.

📌 Tech Stack:

  • Programming language is Ruby
  • Database used is PostgreSQL
  • Framework used is Rails
  • Tests done with RSpec

📌 Key Features:

  • Responsive layout to all screen sizes
  • Four database tables (users / posts / comments / likes)
  • One to many relation between users & posts tables
  • Both comments & likes are bridge tables for many to many relation between users & posts tables
  • Four model files (User / Post / Comment / Like)
  • Method recent_posts allows fetching the last three post for any user
  • Method recent_comments allows fetching the last five comments for any post
  • Private method counter auto increments the number of (posts / comments / likes) for the relevant owner table
  • Several attribute validation rules for User & Post models
  • Attributes (name / title / posts_counter / comments_counter / likes_counter) are required
  • Attribute title length must be smaller than or equal 250 characters
  • Attributes (posts_counter / comments_counter / likes_counter) must be an integer and greate than or equal zero
  • Unit tests for attribute validation rules and model methods
  • Implemented request tests on (index / show) methods for controllers (UsersController / PostsController)
  • Used Capybara gem to carry system tests on (index / show) action methods for controllers (UsersController / PostsController)
  • Built authentication with Devise gem before accessing any controller

back to top

🛠️ Instructions

You can easily download or fork this repository and work on it immadiately!

📌 Prerequisites:

  • You need Ruby language & PostgreSQL database installed

📌 Installation:

  • To get all required gem dependencies run
bundle install
  • Create all required databases & table schemas with
rails db:setup

📌 Development:

  • Run live server using
rails server
  • Manipulate & process models data through
rails console

📌 Tests:

  • Run all unit test with
bundle exec rspec -f d

back to top

👥 Authors

📌 Mahammad:

📌 Zabihullah:

back to top

🔭 Future

Some additional features I may implement in the project:

  • Integrate React framework in frontend
  • Implement (dark / light) theme switch

back to top

🤝🏻 Contributions

Wish to contribute to this project?
Contributions, issues, and feature requests are more than welcome!
Feel free to check the issues page too.

back to top

⭐️ Support

Like this project? Show your support by starring!

back to top

🙏🏻 Acknowledgements

I thank everyone at Microverse for guiding me through this project.

back to top

📝 License

This project is MIT licensed.

back to top