Prayers

A Sinatra Portfolio Project for Flatiron School

PJ Frias
4 min readFeb 17, 2018

The first step was to figure out exactly what my app was going to do. I could not really start planning anything else beyond that. Unfortunately, I had no idea what I wanted to build. What type of things do I collect that I’d want to track? Do I even collect things? Records, woodworking tools, trash on my desk. Nothing that came to mind jazzed me up.

With the hopes of getting inspired, I took to Youtube to try and find past students project demos. As I looked through a few, they began to expand my own thoughts of what sort of app I’d like to build. Then, I reread the project overview and really focused on what it said.

“For this assessment you’ll be creating any sort of CRUD app. The app should be a custom app that is created to track something important to you.”

Something important to me. What was important to me? Friends, family, the typical things. Sure, but I’m not trying to remake Facebook. Then, I thought about how I spend my time. Well, these days, my life revolves around two things: programming and serving in my church community. That’s when it clicked. An app that will collect prayers!

I help lead a group of college age kids, where we meet up and study The Bible. At the end of our time together each week, we share with each other things that are on our mind, things for which we’d appreciate some prayer. There are thousands and thousands of groups just like this who all share prayer requests. A web app that allowed other group leaders to post and collect prayers seemed like a very useful project to build.

With my idea in hand, I could finally start planning. First up - figure out the Models. This seemed very clear cut at the start. Users, Prayers, and Groups. Users had many prayers, and prayers belong to groups. A clean and simple model association. As for groups, Users have many groups, but groups also have many users. This required a join table, and thus a “has many through” relationship. Once I set up the models, and created the tables via rake migrations, I tested everything out with Tux. Everything was working out.

Next, I started to work on the views and controllers simultaneously. I’d jump from setting up a route (get “/prayers” for example) to filling out the view template that would be rendered from that route. Most times, that template included some kind of form that would call a post route which would then bring me back to working through that route in the controller. This was my main workflow through the entirety of the project.

Of course, I ran through numerous snags, often times forcing me to take a step back and modify existing models. I did not like the idea of prayers having many users. I also needed a way to differentiate between a group that a user joined and a group that a user lead. This required association aliasing in ActiveRecord. To me, this took the complexity of my model associations to a point that really challenged me to learn and grow. I went back and rewatched a few lectures, and I also searched online for other resources to help explain this concept. Eventually, I was able to get the associations working out the way I needed.

After a lot of hard work, I was able to nail down all of the functionality required for my project. At this point, I could have wrapped it up and called it quits. Fortunately (or perhaps unfortunately), I did watch a few students demo their Sinatra projects and their apps were quite polished in terms of visuals and styling. I thought back to my last post, and I thought about my real goal of this project, the real goal of this entire web developer program. It is to create a nice Sinatra app, but, more importantly, it was to apply what I have learned and continue to learn in the process. The goal is always to become a great developer. With that in mind, I quickly decided I was going to style my project, too. Not manually, though, but with the help of a CSS framework called Bulma.

I must admit, adding styling into the app was somewhat tedious. It felt like I was almost going back and redoing a vast majority of my code. However, I think that having all of the functionality set up made it possible for me to focus solely on adding styling. Still, I think for my next project I will aim to style the project as I go rather than going back after the fact. Regardless, once my app was styled, the difference felt drastic to me. My project looked not hideous, and it was something I was much more proud to demo and show off. For this reason alone, the extra time and effort , although not required for the project, was undoubtedly worth it.

This project helped to solidify in my mind many of the concepts I had been learning, from model associations to RESTful routing. Going back and adding CSS styling was hugely beneficial for me, as well, as those are some concepts that I have not touched for a little while. Through this project, I have built my first app, starting from scratch, that has any semblance of polish, and seeing everything come together in a functioning app was deeply rewarding and exciting for me. I’m excited for all that I’ll be learning next, and I very much look forward to the next project.

--

--