From the monthly archives:

May 2011

I had several requests in UserVoice to provide a Many to Many tutorial in Rails. This is a demonstration of how to put together a “has and belongs to many” association and a “has many through” association.

This is somewhat basic to Ruby on Rails, but important if you need to associate different models.

Download 161.3 MB
Download iPhone & iPod 97.7 MB

{ 0 comments }

Over the last few weeks I’ve been using macvim and janus to write code. The more I learn about VIM, the more I love it.

It’s not so much that VIM does things that I find particularly natural or “better”, but rather it’s that it’s extremely powerful for opening, managing, and editing files. Each little trick I get brings me more and more to the place where I can code as fast as I can think.

The Pragmatic Programmer (book affiliate link) tells us to know our text editors. The more I get to know about my text editor, the better off I am.

Here’s the video:

{ 5 comments }

On the Ruby Rogues podcast I mentioned that I had moved away from Cucumber to RSpec and Capybara for my integration tests. Here’s a demo on how to do some TDD with RSpec and Capybara.

Download 180.6 MB
Download iPhone & iPod 109.2 MB

{ 15 comments }

There’s a lot more to the ABC iPad app than just the iOS components. There’s a HTTP Live Streaming level to this that manages all of the content for the application and streams it to the devices.

Tyler explains the history of Protoven, Uplynk, and a lot of technical details behind how the ABC iPad app hangs together both on the backend and frontend.

Here’s the video of the interview:

{ 0 comments }

CoffeeScript offers more than nice syntax for setting and managing data and functions. It also offers Classes, Inheritance, access to a ‘super’ method, Ruby-style string interpolation, easy variable and function bindings, and chained comparisons.

Here’s the code I showed in the video:

class Vehicle
  constructor: (@name) ->

  move: (miles) ->
    console.log @name + " drove " + miles + " miles."

class VWBug extends Vehicle
  move: ->
    console.log "Cruisin'..."
    super 100

class Truck extends Vehicle
  move: ->
    console.log "Haulin'..."
    super 50

mater = new Truck "Mater"
herbie = new VWBug "Herbie"

mater.move()
herbie.move()
a1c = "7.6"

healthy = 7.0 > a1c > 5.0

console.log "A1C within healthy range: #{a1c}"
Account = (customer, cart) ->
  @customer = customer
  @cart = cart

  $('.shopping_cart').click (event) =>
    @customer.purchase @cart

If you’re new to CoffeeScript, make sure you check out the CoffeeScript Cookbook and CoffeeScript Basics.

Download 150.3 MB
Download (iPod & iPhone) 87.1 MB

{ 8 comments }

Jamis Buck is a Ruby on Rails developer working at 37signals. He was part of the Rails Core Team, created the SQLite driver for Ruby, and created the Capistrano library for deploying applications in Ruby.

We talked about several things including:

Here’s a video of the interview.

{ 1 comment }

 

Ruby on Rails 3.1 is moving to use Sprockets to compile CoffeeScript into JavaScript and include JQuery in it’s JavaScript by default.

This is a quick demo of how it all hangs together to manage your JavaScript in Rails 3.1.

Download 65.7 MB
Download (iPod & iPhone) 41.4 MB

{ 15 comments }

Tom Preston-Werner is one of the founders of Github.com. He’s a Ruby programmer who has successfully launched a business used by hundreds of thousands of programmers all over the world to host their programming projects. He is also the original developer behind Gravatar.

We discussed how Github.com got started. Tom also mentioned Gravatar, god, and Jekyll.

We also discussed open source software, contributing, hiring developers, and what makes Github such a great place to work. If you want some good pointers about how things should work at a development shop, I recommend this episode.

{ 2 comments }