The Playlister

Marlon Moreno
3 min readMay 2, 2021

--

So, for my 3rd project, I needed to create a Ruby on Rails application. This time a did something completely different from my lasts projects, and by that I mean that it didn’t involve Pokemon. I decided to call my app “The Playlister.” And what it lets you do is make an account, and from there make playlists, and fro there give the songs in your playlists ratings.

So as always I started off with my db tables. I had tables for users, songs, playlists, and a join table called playlists_songs

Then in the models I made their associations, and validations, below are the ones I used for the Playlist model.

I Also set up the API I was using, I would parse the information I would get from the API, from there I would would set the necessary values equal to their corresponding keys inside a hash, and from there I would create or find the songs using that hash.

From here I went ahead and added the necessary routes in routes.rb, and started on my controllers. Let’s go ahead and talk about the playlist controller.

So for each playlist, I wanted to have the ability to give each song in that playlist a rating from 1–5. And to do that I would need to have to make a nested form, since it would be in the same place where you would edit your playlist info as well. So to do that I needed to make Playlists accept nested attributes from Playlists_Song, since that where the rating column is. Which I did by adding the following code to the Playlist model

And the following code to the playlist controller…

And then the nested form, which was probably the part I struggled with the most in this project, looked like this

It took me a while to figure out how to preselect an option, but I was able to figure it out after a while of researching, and making the custom options took a while for me to figure out.

I also set up the option to login from google, which was a simpler than expected.

My experience with the project was very different from the ones Ive had in the past. Not only because my imac decided to die on me in the middle of project week which meant I couldn't even work on my project for about a week, but because its probably the one I’ve struggled with the most. But thats also one of the reasons a can say that I’m really proud of what I did with this project.

--

--

Marlon Moreno
Marlon Moreno

No responses yet