I felt a bit like Jack in The Shining during this project, feeling like I was trapped in this big house in the mountains with forces I don’t understand. However, I finished my JQuery Rails project and learned a ton and made it out of the hedge maze alive.
I wired up AJAX requests for my user show pages, which also included a list of their loglines (a movie or TV show description.) For this, I created a JS user object and used Handlebars template to display the user show pages and all of their loglines. Within each logline, the user has the option to rate a logline 1-100, but you can’t rate your own loglines and you can only rate a logline once.
I learned a lot doing this project, but I’m also left with several questions that I’m sure I’ll figure out down the road. One issue I noticed was when I manually typed in a URL for a user, ‘/users/23’ for example, (23 being the number for the greatest player of all times, LeBron James, of course) the JSON viewer would immediately pop up. I’m guessing this is an issue with not having the show page setup. Also, when I used Ajax from an index page, I didn’t have access to the @user instance variable, I only had access to the index, which forced me to rely only on JSON. I’m not sure if there’s a way around this issue.
This project got me thinking a lot about design as well. Knowing how to use AJAX properly, I would have certainly designed my Rails project differently. Learning to use APIs and JSON feels a bit like graduating college — I feel like an adult coder now, but I also know there’s still so much to learn.