[go: up one dir, main page]

DEV Community

Swislok-Dev
Swislok-Dev

Posted on

Ruby on Rails web app

I wrote my first Rails app and it proved to have issues. A certain requirement for this project involved nested routes. Understanding the concept has been a bit difficult for me to grasp, but the longer I've been using it the more it has been making sense. I used a simple three model design with two being has many-to-many relationships which were the User model and Manufacturer. A belongs-to relationship for the Gun model to create my join table between both the User and Manufacturer.

My development workflow seems to go better by writing out code within the controllers and testing to see how the app reacts. While trying to save myself some time by creating helper methods beforehand can have it benefits it has also been the cause of more problems (and time sink) to debug than worthwhile. Needless to say, everything in the first cycle of development has taken awhile due to re-writes from the helpers to controllers and I have learned the valuable lesson of always writing less and testing more.

Creating flash messages have been a thing to go over more times than once and always forgetting to render them in the application layout in order to see what it is that I'm doing.

A valuable lesson has been learned during this project and that is mainly with the refactoring. I wasn't too sure on how refactoring was supposed to work nor did I see it's value until this Rails app. To me now, refactoring the repetitive code makes a little more sense considering how often it can be used within views. For example a method that has the potential of being used many time would be inches_or_mm(gun) that takes the argument of a gun object to check the caliber and change the input from "40" to "0.40 inches" or 9 to "9 mm". This information is presented to the user clearly what size of bullet would be used with this particular model of gun. Partial forms are something I would like to use more in the future as with the extend of this project had portions that could have more than one form added to each view to bring out the diversity of searching or filtering criteria on a much fuller database.

As far as the database is concerned, I was having difficulty finding a usable endpoint so that I may have a wider range of use with this app, but I think if I were to have access to such resources having an admin role to control more aspects of user experience would enhance a more direct approach to use this as more of a catalog to search through different manufacturers and find a gun that suits a shopper's interest.

Top comments (0)