Databases & Rails: Week 8
07 Aug 2012Welcome back, this week we’re going to tackle some important concepts in Ruby like Dealing with Nil and using Modules in Ruby. We are also going to cover importing data from a spreadsheet, rake, rubygems, bundler, and talk a little about Rail’s testing ecosystem.
Recap of week 7. Then take the Quiz and review the Solutions
Before we get started there have been quite a few questions about why not use a simpler solution than Rails, so I recorded a quick explanation of Simple Versus Hard and why we might want to pick a more complex tool to solve our complex problems
Rails Testing Ecosystem
As your app gets more complex testing components gets even more critical. In this video we cover the basics of what testing does, and then we talk about a few tools we can use to automate tests in our Rails code.
Rubygems & Bundler
Rails is a rubygem, but what is a rubygem? We’ll cover that in this video as well as exactly what bundler does, and why we should always keep the Gemfile
and Gemfile.lock
in our source control.
Import data into Rails from a Spreadsheet
By popular demand learn how to read spreadsheet data into Ruby and then put it in Rails.
Intro to Rake
Rake is a useful command line tool, learn how to write your first rake task and how to use Rake together with Rails.
Dealing with Nil
As a Ruby programmer the most common value you’ll encounter will be nil
. It’s our duty to be on constant watch for nil
and make sure it doesn’t reek havoc on our code. This video will introduce you to some boolean logic we can use to defend against the tyranny of nil. We’ll then cover using nil?
and empty?
as well as several custom Active Support methods we can use from Rails to help guard against nil. Nil isn’t all bad, at the end we’ll see how we can use this functionality of nil to populate variables only if they don’t exist. We’ll use this to find or create a user in Rails.
Using Modules in Ruby
Modules are an extremely important part of the Ruby ecosystem. Learn how to mix in methods into a Ruby class using modules in this introductory video.
Exercise
This week we’ll start a Hero’s journey to build a site similar to Reddit. You’ll need to use everything we’ve learned so far. This isn’t a follow along copy and paste tutorial, this is how I work when I’m making websites. Good luck, you’ll need it. Building Reddit on Rails.