Flatiron Rails Project — Bookshelf Redux

Sam Troutman
2 min readJul 25, 2021

For the third phase of our Flatiron program, we learned Ruby on Rails. This phase was admittedly difficult for me — even though we built on our knowledge of Ruby, learning more about relationships and nesting especially on Rails took more work.

For my project application, I decided to continue working with the idea of a Goodreads-inspired app where users could add and review books. In this case, users and books would be connected through reviews — a user would have many books through reviews, and books would have many users through reviews. Books also belonged to genres, where a genre would have many books.

To get started, I first set up the models and migrations through the Rails resource generator. Being able to quickly create parts of the application make Rails efficient to use, where I could spend more time working on the details and functionality of the relationships versus having to build out each individual file.

After setting these up, I then got to work on routing the various actions, setting up their corresponding controller, and then each view. While Rails makes this easier, this is also one of the concepts I had the hardest time grasping, especially the nested routes and accessing variables. Though there was a learning curve, I definitely learned to appreciate the intuitiveness and built-in simplicity that Rails offers. For example, I was able to create forms partials that could be used in separate views without having to repeat the code. Routes were made easier by the fact that Rails can infer which paths to use.

The introduction of OmniAuth also proved difficult — though I was able to follow the instructions from our previous lab, I felt as though I kept doing something wrong and the code wouldn’t work. I ended up following this tutorial and it worked great.

Future thoughts and ideas:

  1. Adding functionality to see all books attached to a genre
  2. Pulling in a list of books so users don’t have to add them individually
  3. Creating book lists (i.e. want to read, reading, read as Goodreads has)
  4. Adding an author model, where an author could have many books, and a user could have many authors through books.

--

--