w4d3 - Everybody gets a cat!

    Today we finished creating our 99 Cats application that we started yesterday. Although it was completely silly, I’m very pleased with the results. You might look at it and think that we called it 99 Cats because it looks like it’s from 1999, but all the function is there! Users can now sign up and log in, like a typical website! We utilized a session helper method in Rails to read, set and destroy cookies. And we used a session_token column in our users table to check whether or not a user was logged in. This also enabled us to check the current user pretty easily by comparing the session toke stored in the database to the token store in the users’ cookies.

    Throughout the project, we were able to put together everything we’ve learned so far, creating new routes (generating only the ones we needed to use), linking those routes to controllers, setting up the actions in the controllers to render or redirect to the desired page, and we also got a lot of practice creating forms and buttons (which apparently have to be wrapped in forms to work correctly). We were even able to get buttons to appear and disappear based on user permissions. For example, only the cats’ owner was allowed to Approve or Deny rental requests. Other users couldn’t even see the buttons. In addition to that, we made sure to add checks into the controllers themselves to prevent a user with insufficient rights from making any changes they weren’t authorized to make. Rails really makes things like that fairly easy to do once you know your way around a bit.

    There was a bunch of refactoring that we could have done to make the HTML cleaner. In particular, we could have used a couple more partials to DRY up the code in our views, but overall I was excited to see the application working as we wanted/expected it to. Tomorrow is actually a solo day where we get to build another app from the ground up, using everything that we’ve done in the past 2 days and hopefully creating something even better than the 99 (though that will be difficult!).