Devchat.tv Episode Roundup

Devchat.tv Episode Roundup

Download on the App Store

All Devchat.tv Episode Roundup episodes

  • Single Table Inheritance – Ruby on Rails Tutorial
    Single Table Inheritance is a great way to handle related models that descend from the same class. The classic example is a Car class with Ford, Chevy, and Honda subclasses.
    This Ruby on Rails Tutorial provides an example and explains how Rails puts all of the information in the same database table and allows you to query things from both the superclass and subclass.
    Download 59.5 MB
    Download (iPod and iPhone) 36.3 MB
    0 min
  • Single Table Inheritance – Ruby on Rails Tutorial
    Single Table Inheritance is a great way to handle related models that descend from the same class. The classic example is a Car class with Ford, Chevy, and Honda subclasses.
    This Ruby on Rails Tutorial provides an example and explains how Rails puts all of the information in the same database table and allows you to query things from both the superclass and subclass.
    Download 59.5 MB
    Download (iPod and iPhone) 36.3 MB
    0 min
  • Single Table Inheritance – Ruby on Rails Tutorial
    Single Table Inheritance is a great way to handle related models that descend from the same class. The classic example is a Car class with Ford, Chevy, and Honda subclasses.
    This Ruby on Rails Tutorial provides an example and explains how Rails puts all of the information in the same database table and allows you to query things from both the superclass and subclass.
    Download 59.5 MB
    Download (iPod and iPhone) 36.3 MB
    0 min
  • 005 RC Testing Tools for Rails
    There are a lot of tools for testing Rails. Here are links to several of the ones mentioned in this podcast.
    Test Unit
    RSpec
    Cucumber
    Mocha
    Flexmock
    Factory Girl
    You can find my interview with David Heinemeier Hansson here, and my response to his comments on Twitter here.
    Finally, here are a few other resources for you to get started with testing Ruby on Rails.
    Introduction to Outside-In Development with Cucumber
    Here's a transcript of the podcast:
    Rails Coach Podcast, Episode 5
    Hey, everybody, and welcome back to another Rails Coach podcast. This is Charles Max Wood and this week we’re going to go into testing Rails. You can test Rails in a lot of different ways, and we’re going to talk about some of the libraries that are around for doing that. I’m also going to talk about my approach to it; some of the things that I’m thinking about doing or changing – and I guess we should just dive right in.
    First off, I want to point out that there’s been a discussion on Twitter about Test Unit vs. RSpec. Now, if you’re not familiar with Ruby on Rails or who David Heinemeier Hansson is, then I recommend that you go listen to the “Teach Me To Code” podcast. I interviewed David on that podcast and talked a little bit about Ruby on Rails. And that will give you kind of a feel for who he is. He’s the guy that wrote Ruby on Rails and he is the technical partner at 37signals that makes Basecamp and Highrise and a bunch of other products that I used to use. But I don’t anymore. And that’s not the topic for this podcast. Anyway, we’re going to go into some of the things that are available for testing Ruby on Rails. I’m going to go into, first off, the discussion that was had over RSpec and Test Unit. David Heinemeier Hansson, a while back, said that he and 37signals, they used Test Unit, and that Test Unit and Mocha, which is a mocking and stubbing framework were basically all you need for good Ruby on Rails testing. Then he later said that he was a little disappointed by the proliferation of RSpec and Cucumber because he felt like they were a little too complicated and had been cargo-culted upon the Ruby on Rails community. And that started a whole lot of discussion over whether or not RSpec and Cucumber were the right tool. There were people who came out and said, Oh yeah, David’s right. Test Unit all the way. And other people came out and said, Hey wait a minute, RSpec all the way. David, you’re an idiot. And some people had kind of the reaction that I had where we thought about it for a minute and said, I’ve been using Test Unit or RSpec for a while, and I really ought to explore what the differences are and why I might want to use one over the other. I really haven’t had a chance to do that. However, I have used both; I’ve used both on different projects. And so I think it is worth discussing testing tools that are available for Ruby on Rails and what you can do to learn this stuff. So we’ll jump right in here. First off, I use – I’ll let you know – I use RSpec and Cucumber, and I use Factory Girl to generate my objects that I am going to be testing against. And then I use FlexMark for mocking and stubbing. That’s more or less what I use. Now, with Cucumber I use Capybara. And then I’ve recently started using Culerity and Celerity to test my JavaScript. And that has been working, actually, really well.
    So, basically I use RSpec to do some of the testing in Cucumber. For example, you can write your assertions or dot-shoulds in Cucumber steps, and if they fail then your Cucumber scenario fails. RSpec I also use for my unit tests. And unit tests are just class-level tests. They usually use some method of mocking or stubbing to isolate your object so that you can test one way or the other, or if you have a dependent object, then you don’t necessarily have to mock that out. It’s a matter of preference as to how deeply and how thoroughly you mock things out. In my case,
    14 min
  • 004 RC Ruby on Rails Model Validations
    You can get the video version of this podcast here.
    I've also updated the audio files for episodes 2 & 3 so you can hear them now. Sorry for the trouble.
    Ruby on Rails provides some excellent ways to validate the data you save in your models. Validations are methods called within the class definition specifying an attribute to check and what to look for.
    class User < ActiveRecord::Base
    validates_presence_of :username
    end
    Validations are called when you call 'save', 'create', or 'valid?'. If there are validation errors, create will return a new but not saved (to the database) version of the object you were creating. 'save' and 'valid?' will return false.
    You can get validation errors from the object by calling 'errors'.
    I also go over some of the common validations in the podcast.
    13 min
  • 52 TMTC The DHH RSpec (and other) Debates

    David Heinemeier Hansson sparked a debate on Twitter about Ruby testing frameworks. A lot of people saw it as slamming RSpec and others saw it as constructive conversation about what tools you use and why. This is how I view to see it and where I come down on this debate.

    I also discuss why we have these debates in general and what we can learn from them.

    18 min
  • 51 TMTC Being Nice (MINASWAN)

    At Mountain West Ruby Conference, Mike Moore brought up that many members of the Ruby community have lost part of the community roots. Particularly, the acronym MINASWAN, which stands for “Matz is nice and so we are nice.”

    There are a lot of people out there who, rather than looking to help, are looking to fight or trying to look good. The funny thing is that if you can make a real contribution, you do look good. So, here's a discussion on how to contribute to the community in a positive way.

    18 min
  • 003 RC Single Table Inheritance (STI)
    Single Table Inheritance is a slightly advanced topic in Ruby on Rails. It stems from class inheritance, which is a core Object Oriented Programming principle.
    In Ruby, if you inherit one class from another, you use the '<' operator. Here's an example:
    class Truck < Car
    end
    In Rails, this gets tricky because when inheriting a Model, do you use the parent models connection and table? or your own? By convention, you use the parent's table, which means that you need some way of differentiating the Trucks from the rest of the Cars.
    So, by adding a 'type' column to your table—which is a string—you activate a Rails convention that stores the subclass' classname in the type column. So, in the case of the Truck class, you'd have all of the Car's attributes and a type column that is populated with the string "Truck" to denote that it's a truck.
    When doing a Model lookup on your database, Rails tacks on the "AND type = 'Truck'" for you.
    Download this Episode
    10 min
  • Compass, SASS, and the 960 Grid System – Delicious Clone
    In preparing to show off SASS, I found the Compass system, which uses SASS and organizes your stylesheets in a unique way. In this tutorial, I walk you though installing compass, installing the 960 grid system, and organizing your SASS stylesheets in an intelligent way.
    One note, I couldn't remember the URL for the 960 grid system. It's http://960.gs
    Download 158.5 MB
    Download (iPod & iPhone) 97.3 MB
    0 min