Dev Bootcamp: Phase 1, Week 3, Day 2

After getting so much done yesterday on recreating the functionality of ActiveRecord, the morning challenge felt like a bit of a repeat. My pair and I were able to complete the challenge with few problems, but I think it was still somewhat useful to review the CRUD methods using pure SQL+ruby.

In our afternoon lecture with Shereef, we went over a multitude of topics: dynamic generation of instance variables, heredocs, metaprogramming, etc. After this we finally got into ActiveRecord, and it was glorious.

After having to implement a fair few of the ActiveRecord methods ourselves, it gave us a much deeper understanding and appreciation of them. As I mentioned previously, when I had tried to learn rails in the past I was a bit put off by the amount of magic that seemed to happen under the hood, so the progression of the Dev Bootcamp syllabus was perfect for me.

The challenge itself wasn’t particularly difficult – we built a Student class connected to a students table by way of ActiveRecord. Adding validations was the most fun part: we started by adding validation methods and ‘validates :validate_email_address’, then refactored into ‘:validate :email, format: { with: /\A.+@.+\..{2,}\Z/,
message: “must be a valid email address” }’, into ‘:validates_format_of email: with: /\A.+@.+\..{2,}\Z/’. For the last one we didn’t even have to Google it – we just guessed that ActiveRecord might be clever enough, tried it, and high-fived when it did.

Being Tuesday, the day ended with another Engineering Empathy lecture. I thought that last Tuesday’s was intense, but it was nothing compared to today. Afterwards, we all hung around for a bit eating the sympathy pizza, then promptly headed for a much needed three beers.

Leave a Reply

Your email address will not be published. Required fields are marked *