Ruby

http://s.erious.ly

Author Archive

Using ActiveResource to consume web-services

Today I’m reviewing Joe Van Dyk’s monkeycharger application, which is a web-service for storing and charging credit cards. I loved looking at this app, because its only interface is a RESTful web service: there is no HTML involved. (If you’ve never written an app that only exposes a web-service UI, you ought to. It’s...

Testing the Right Stuff

I’m going to take a slightly different tack here, and review some of the unit tests in rails itself. They show up two common anti patterns, spurious assertions and coupling your tests to the implementation.

Perhaps the biggest benefit of a suite of unit tests is that they can provide a safety net, preventing...

Dangers of Cargo-culting

“Cargo culting”, when used in a computer-programming context, refers to the practice of using techniques (or even entire blocks of code) seen elsewhere without wholly understanding how they work. (The term “cargo cult”, if you are unfamiliar with it, has its own fascinating etymology, which is covered nicely at wikipedia.) Cargo culting is a...

Free-for-all: Tab Helper (Summary)

The first RailsWay free-for-all came off quite well. Many of you posted your favorite solutions to the problem of tab-based navigation, as posed by Nate Morse. Jamis’ Take Of all the solutions posted, my personal favorite was the p...

RailsConf Recap: Named Callbacks

Another topic we touched briefly on at RailsConf was the idea of named callbacks. Consider this snippet (also from Brian Cooke’s expense tracking application): 1 2 3 4 5 6 7 8 class Expense < ActiveRecord::Base protected ...