< prev 1 Dec 2014 to 1 Dec 2014 next >

Posts from 1 December 2014

  • Week 3 Day 4 - What the SQL?!

    Today's partner: Eva

    The assignment today was deceptive. It began simply enough—with me completely forgetting everything I learned about ActiveRecord last week. Wait, back up.

    Today's assignment expanded on what we learned about ActiveRecord before Thanksgiving. It took a little bit to warm up, but thankfully Eva had done enough practice to get me on track quickly. It was a lot of boilerplate: has_many( :method_name, class_name: "Blah", ...) (which is a bit annoying, because of course the solutions all use the more succinct forms of relations), which seems somewhat typical of this phase of Rails.

    The project centered, again, around a standard online trope: the survey. Polls, Questions, potential Answers, and Users and their selections from these answers. The core work: outlining the migrations, defining the initial validations and relations, and adding indices all went smoothly, and we were done with the core logic that was demanded of us (mostly custom validations) well before 2. There was a bit of tricky SQL and ActiveRecord Relation syntax (not logic, per se) that we struggled with, but overall it was very smooth.

    … and then came the Bonus work. Four hours of bonus. Holy mother of god, there's some convoluted rules for what can and can't be put in different places in a Relation. (joins can't take parameters… wat.) However, I gained some respect for the power of building queries step-by-step, especially when Eva and I stumbled across the finish line and read through the solutions. One of the validations we struggled with was addressed by defining the SELECT logic and the JOIN logic separately from the heart of the SQL statement, then glued everything together, firing off a single db query at the last possible moment. Pretty neat.

    I'm a bit concerned about the upcoming assessment (this Wednesday, although I need to do at least one practice run tonight) because it's clear that it takes me a minute to spin up when it comes to starting work in Rails. I have time to practice, and as long as I make use of it, I should be fine.

< prev 1 Dec 2014 to 1 Dec 2014 next >