Woof, I have a bug

Samantha Aleman
2 min readApr 5, 2021

Howdy I am here to talk out loud to try to figure out my bug.

Back in September, with the skills that I had I tried to create my own “version” of twitter. Instead of typical just tweeting about what you’re doing, it’s simply to document the dogs you see in the day. I knew once I knew more about coding that I was going to go back in and make it more dynamic.

Well, the day has come and I am in the process of making it better. However, I have come across a small bug. I wanted to include the famous “favorite” button with the little heart. I already added the heart and the css to go with it. The problem is that for each “tweet” to show up on your homepage I have it in an each loop so that each can populate the page and also be a link to the actual show page of the single sighting. Here’s the code for reference:

Now if youre still following along, the problem is that when I click on one of the hearts. If it’s not the first tweet then it won’t change. Only the first one is changing at the moment. Here it is for reference:

I fixed my database, and added in a column for the heart and made it a boolean. I think that my next move is to add in an if statement that if its toggled then to set that value as true so that it can save it my database and then each favorite button will then work? But i’m still confused, so if anyone has some helpful insight I’m all ears!

--

--

Samantha Aleman

Fullstack software engineer with a passion for code, space, and corgis