Rails Project: BookClub

Jazmin
2 min readMay 10, 2021

The web application that I created allows users to create book clubs (it is conveniently called BookClub 🙂). Users can add books to clubs in order to join the clubs. They can also comment on different books for everyone to see.

This project was no joke! It required me to really break it down step by step. The first thing I did was run resource generators for the following models: User, Club, Book, and Comment. One of the trickiest parts about creating this project was working with the limitations of the simplified relationships I decided on in order to adhere to the association requirements. The relationships are as follows:

Users: has many comments, has many books, has many clubs through books

Clubs: has many books, has many users through books

Books: belongs to a user, belongs to a club, has many comments

Comments: belongs to a user, belongs to a book

The books table is the join table for users and clubs. While this setup allowed me to finish this project within two weeks, it did not allow for the functionality that I originally set out to create. I spent a long time trying to think through the limitations such as:

  • Needing to add a book to a club in order to join it
  • The possibility of having duplicates of the same book created due to the above bullet point
  • The club not having a user that is the owner and therefore considering whether or not clubs should be deletable

In the future when I return to this project, I would love to add more functionality by rearranging the associations and adding admin features so that users can be in charge of clubs.

Another thing that was tricky about this project was incorporating the devise gem with google omniauth. The devise gem was amazing! It took care of all of my user authentication. However, as soon as I finished installing the gem I was overwhelmed by all the things that it created and how exactly it worked. I spent a few days reading the codebase so that I could better understand all of its magic. I enjoyed having to read the devise codebase and feel that it was really good practice for when I need to read someone else’s code.

Overall, while this was the toughest project yet, it was really fun to juggle so many files and tiny details to ensure that everything works!

--

--