Ruby on Roids… I mean Rails

Wesley Spencer
3 min readFeb 7, 2021

--

Wow… That’s one word of many to define how I feel about Rails. Going from Phase 1 to Phase 3 has been a fun and bumpy ride, but I feel really comfortable with where I am at in my knowledge with Ruby. I of course know there is still a lot to learn and even the things I have learned could still use some improvement. I realized last phase I had the knowledge and knew the mechanics of how things worked with Sinatra, but what I didn't excel at was my vocabulary in curtain subjects and explaining the mechanics out loud. My goal is to get better at this. Phase 3 has brought many challenges. I’m going to attempt to explain some of the speed bumps I hit and how I was able to overcome these problems.

My project this phase is a social media application where you can subscribe, comment, and reply to articles. The app as a live API that constantly updates with new articles from different sources all across the the U.S. This was tricky to do for me because I had only dabbled in one other API before this one. I had to narrow down my calls and sort them by articles published in a descending order and only articles that were published within the U.S. I found how to do this with the documentation provided by https://mediastack.com/documentation. A little bit of time and effort I was able to drag out exactly what I was looking for. http://api.mediastack.com/v1/news?access_key=12345678978945612312340ff&countries=us&sort=published_desc.
Setting up the table was cake from that point on thanks to what the prior phases taught me.

My next step was to display all the articles I had created with my API. I quickly realized I didn’t want 100 of articles rendering on a single page. Hence my next speed bump. Pagination. I needed a way to display 25 articles on a single page at a time. I was never taught this before I didn’t even know what to ask google? I was determined to find out how though. I search forever on good, I even inspected googles pagination, but to no avail I was still stumped. I finally hopped in AAQ . AAQ usually doesn’t help with projects, but since pagination wasn't part of the curriculum they pointed me to a great source. I then continued to do more research and found this awesome gem called Kaminari. I looked up the documentation and a YouTube video to help set up the pagination. All went smooth on setup.

While talking about gems another great gem my cohort lead showed the class was the devise gem. This was not really a speed bump, but rather some knowledge that kept me from running into more speed bumps. Devise is a gem that creates a user for your project. It creates user authentication, it creates sign-up and sign-in forms, it also can be used to create user accounts for privacy.

Good sometimes is followed with a little bad. Omniauth, another great gem, however a little tricky implementing it with Devise. Omniauth is a gem that authenticates and creates a user through another application such as google, Facebook, GitHub, etc. After a weekend of researching I found out that Devise does not set the method ‘POST’ to the link to within the view of registrations and sign up. Easy fix none the less.

This concludes the main issues I conquered in my project. There were more small hiccups, but nothing I didn't figure out within the hour of working on it. I really enjoyed this phase, and I am really starting to feel confident in my ability to be a software engineer. Lets hope Java Script doesn’t take me out. Until next time!

--

--

No responses yet