Nathan Weizenbaum is the man.

Posted by jeff Fri, 18 Apr 2008 13:24:00 GMT

Nathan is part of the team that gave us Haml and its obvious that he genuinely cares about it and the people using it. He made a post on his blog called "Haml Errors Suck" helping to explain the sometimes cryptic error messages that Haml throws and also asking for complaints, advice, etc. about those messages and other problems with Haml.

I was suffering from the no-output error that can occur when your Haml template is malformed in Rails pre 2.0.2. And it looks like Nathan spent the better part of yesterday making Haml work smoothly with versions of Rails all the way back 1.2.X.

Nathan's humility and hard work make him one of my personal Ruby Heroes. Thanks, Nathan.

render_to_string

Posted by jeff Wed, 26 Mar 2008 12:28:00 GMT

Rendering a view in Rails to a String

This is old hat for pros, but this is such a useful method that I wanted to bring it up for anyone googling for this functionality (as I was months back).

Occasionally you'll want to render something in rails and keep the result in a string (to save into a db or file or to display later) rather than displaying it immediately. If you try to make a call to render and then go about your business redirecting or displaying another view you'll get a wonderful ActionController::DoubleRenderError telling you "Can only render or redirect once per action". You want to use render_to_string.

Example: rendering a haml template that has been loaded into template_content

rendered_result = render_to_string( :inline => template_content,
  :type => :haml,
  :locals => { :blah => @blah }
)

Firefox highlight search quirk & Gmail - A Cautionary Tale

Posted by jeff Wed, 05 Mar 2008 04:56:00 GMT

Imagine you're writing someone about a possible job using your fancy Google Apps for Your Domain gmail app. As you're proofreading you notice you've inconsistently capitalized a specific proper noun. Oops. No worries, right, this is what Ctrl-F is for... But if you click highlight when searching your email text, make sure you unclick it before sending... otherwise you end up actually sending an email with highlighted text and, undoubtedly, looking foolish.

Good game, firefox, you're too helpful.