Another Rails Plugin: LabeledFormWithErrors

Written about 11:44 am — Monday, March 31st

Today I released my second plugin for Rails.

It’s pretty simple. It’s a set of 4 helper methods, based on the form builder that comes with Rails 2.0+ that provides you a sane way to present the error messages from your Model validations on form labels. That’s enough tell, on with the show!

# app/models/person.rb
class Person < ActiveRecord::Base
  validates_presence_of     :name, :age, :gender
  validates_numericality_of :age, :message => "must be a number"
  validates_length_of       :gender, :is => 1, 
    :message => "must be exactly 1 character"
  validates_format_of       :gender, :with => /^[mf]$/,
    :message => "must be m or f"
end

After submitting with all fields blank, the example scaffold form looks like this :
People: update

That’s pretty much it. As Jamis says, “never use a plugin you would not be able to write yourself.”

You can clone the plugin repo using git from

git://github.com/cee-dub/labeledformwitherrors.git

or download the tarball here

St. Patrick’s Day fire in the Mission

Written about 3:02 pm — Thursday, March 20th

The house behind mine is on fire and getting worse

Photo originally uploaded by cee-dub.

The fire was right behind my house. This is a photo I took with my iPhone, the only camera I had available at the time, right before leaving the house in case the fire jumped over Poplar St. to my building.

This photo got picked up and twittered by Laughing Squid about 20 minutes after I posted it directly to flickr from my iPhone.

Apartment bouldering FTW

Written about 3:56 pm — Thursday, February 21st

Apartment bouldering FTW

Is it possible that I’m really into rock climbing when I start climbing things that aren’t even close to rocks?
Photo originally uploaded by linoleum jet.

Google Adds Terrain Maps and Public Transit Routing

Written about 4:12 pm — Friday, November 30th

I’m very impressed with Google Maps. The team there frequently adds useful features in well-executed ways.

Just today I noticed two new features. The first, is Terrain map tiles that feature both shaded relief of the actual terrain and road detail. This is what the Hybrid view wishes it looked like. Bravo!

The second new feature is the option to get directions for public transit! This is great, especially for a city dweller such as myself. However, I don’t think they’ve worked out all the kinks in this one :)

This is not the best commute route to work: Update: Google has optimized the route and now it’s right! No more Caltrain to Millbrae ;)
View Larger Map

Still, I think it’s a great addition, especially if I was traveling farther than just to work, or outside of my normal stomping grounds.

Installing Rails Today

Written about 11:13 pm — Wednesday, May 16th

It seems that a lot of old blog posts are floating about on the web these days with instructions on how to install ruby/rails/mysql/etc. that are quite out of date. My post on the same topic included. I’d like to remedy that situation, since I just reinstalled my OS today and had to go through the steps once again. So here you are, internets, my contribution to keeping blogged instructions up to date…

I’ll be covering the steps necessary to get the full Rails stack running on your Mac (Rails, Mongrel, and MySQL), just in case you want to click fewer links and get more done.

To reiterate:

A Favor

Please don’t email me asking for help. I feel bad writing that, it feels pretty crummy to say, and I truly wish that I could answer specific questions about these instructions and help figure out why a certain step might have gone wrong for you, but I just can’t.

Just make sure to follow each step (Install Xcode! Set your path!) and these instructions should “just work” for you.

Getting Started

The major steps are

  1. Make sure you have XCode installed
  2. Set up your $PATH
  3. MacPorts!
  4. Gems
  5. MySQL
  6. Fire it up!
  7. Optional stuff (Subversion, RMagick, etc.)

Let’s roll… Read the rest of this entry »

Heading South

Written about 3:08 pm — Wednesday, February 7th

Yeah. I don’t write much. I’ve been busy. You might get to find out why if you are in Austin the week of SXSW Interactive. Come to our party:

Satisfaction - 8-bit party

Back to work!

Get running with Rails on OS X Tiger

Written about 11:43 am — Monday, November 27th

Follow these instructions and your shiny new MacBook will be ready for you to write the next hot Rails app in very little time.

I’ll be covering the steps necessary to get the full Rails stack running on your Mac (Rails 1.2, mongrel, and MySQL 5). I’ll also tell you the easiest way to get Subversion and RMagick working, in case you want to click fewer links and get more done.

This post is meant as an update to the excellent, but now out-of-date, instructions written by Dan Benjamin at hivelogic.com: Building Ruby, Rails, LightTPD, and MySQL on Tiger

Dan says it best, so I’ll quote him here. Please understand that this applies to me as well.

A Favor

Please don’t email me asking for help. I feel bad writing that, it feels pretty crummy to say, and I truly wish that I could answer specific questions about these instructions and help figure out why a certain step might have gone wrong for you, but I just can’t.

Just make sure to follow each step (Install Xcode! Set your path!) and these instructions should “just work” for you.

Getting Started

The major steps are

  1. Make sure you have XCode installed
  2. Set up your $PATH
  3. Compile Ruby
  4. Get gems
  5. Install MySQL
  6. Fire it up!
  7. Optional stuff (Subversion, RMagick, etc.)

    Read the rest of this entry »