DEV Community

loading...

First Complete Rails App

Salmaan Ali
Excited to launch a career in software development!
・2 min read

Having learned from my last few projects, I made sure this time to spend a few moments planning rather than jumping straight into coding. And it saved me a ton of headaches! I drew out my models with each of their attributes and illustrated their relationships. And it was through this process that I realized some initial model ideas weren't going to work out. Eventually I came up with the project idea for allowing users to create galleries where they can save their favorite paintings.

Once each those models were fully concocted, I was ready to start building the rails app.

Another thing I've learned from my past projects is the importance of seed data. It makes testing the app SOOOOO much easier! Previously, I would build the seed data manually. But a friend put me on to the faker gem. And it made generating random attributes so much easier. And way more fun too! Now I've got random StarWars characters as my users and random book titles as the titles of my paintings.

Onto the developing!

Most of the process was pretty smooth. I've grown comfortable with the basic MVC structure and so, building out the foundation of the app was relatively seamless. But once I started building the form views, I challenged myself to use the new form_with actionview helper method rather than the form_for or form_tag helpers that I originally learned. Knowing how the latter two worked definitely helped understand the former, but it did take some time and research to learn how to properly use it.

The fields_for form was also challenging. I hadn't used it much before and it took some time to learn how the data was captured in params. And then also how to submit those params datapoints to a nested model. After many quick trial and errors, I slowly examined the full process and realized that the issue I had was a missing setter method for the nested model. Once I build that new instance method into the model, it was smooth sailing again.

In the end, it was a success :) It sure had its fair share of challenges, but overcoming each hump is such a gratifying feeling!

Discussion (0)

Forem Open with the Forem app