Image for post
Image for post

I previously made a blog post about how to make a like button with Ruby on Rails, and since my Flatiron cohort has now moved on to JavaScript, I figured I would make a follow up post.

For the purposes of this post I’ll be hooking my JavaScript up to a very simple api with a data structure that looks like this:


If you’re going through Flatiron Bootcamp, or just learning how to use Ruby and JavaScript to create dynamic web applications in some other context, this might be a helpful article for you, if you’re not, I hope you enjoy the ride anyways.

Image for post
Image for post

As I mentioned above, this blog post will be about JavaScript and Ruby, with a small splash into fetch requests. I recently ran into a bug when I was coding, where the fetch request kept altering my data in strange ways that didn’t seem to make sense.


Image for post
Image for post

Intro:

This blog will be a tutorial on how to implement a like function into a rails application. One thing to take note of before we begin is that while this is aimed at people who are relatively new to Rails, you will need a level of foundational knowledge in order to get the most out of this blog, if you have trouble understanding the terms I use I recommend googling around for some more comprehensive blog posts that cover the basics before coming back here to learn this specific implementation.

Step One:

The first thing we need to do is map out the relationships between our models, and take note that you don’t need to name your models the same as mine, mine are just examples. Carrying on, our User models will have many Likes, our Posts will also have many Likes, and each Like will belong to an individual User and a single Post. These relationships can be imagined like…


Hello, my name is Ariel Grubbs, and this is the first of a series of blogs I will write about my experience learning programming. It will hopefully prove helpful to some of you out there who are also just getting started in the programming world, or are just looking to get another perspective.

So, with introductions out of the way, let’s get started with our topic for today: The Importance of Explicitly Ending Methods Before Calling Other Methods in Ruby. Not a very catchy title. I was recently creating a CLI project where my idea was to send the user into a chain of methods that would display choices for them and allow them to navigate through the application with a degree of freedom, and while making this program I kept running into the problem of my code looping back to an earlier point without the user telling it to do so. …

Ariel V Grubbs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store