Godbit Is A Blast

March 13th, 2007

I had a really great time last night at the Godbit dinner. We had 30 people there – what a great turnout! Thanks to everyone who came!

TGI Friday’s is a good location for this sort of thing. It was a bit crowded at the table, but the location can’t be beat. We even got to watch the bats at the Congress Avenue Bridge.

I hope this doesn’t sound too sappy, but I feel really privileged to be in association with you guys and gals. The Godbit crew is a fantastic group of professionals and just plain good people.


SXSW Godbit Dinner Upcoming

March 9th, 2007

It’s just about time for the 2nd Annual SXSW Godbit Get-together! If you’re in Austin for SXSW or just in Austin, come on by TGI Friday’s on Sunday night. TGIF is literally right down the street from the convention center, so you should have no excuse to miss out. Come meet me and 15-20 other Godbit folk as we de-lurk and meet each other in person.

Oh, if you plan to come by, please let me know by signing up on the Upcoming.org page. That way I can let the restaurant know how many to expect.

And as Nathan Smith said:

Please note that you do not necessarily have to be a registered attendee at SXSW to come to the Godbit dinner. We simply plan the dinner around the conference because it seems to gather a large geek following. Plus, we did it last year so now it’s tradition! Come one, come all – and bring a friend.

The Upcoming.org page:
http://upcoming.org/event/151915

The Godbit forum thread:
http://godbit.com/forum/viewtopic.php?pid=13721

The article on Godbit.com:
http://godbit.com/article/godbit-dinner-07

When: Sunday, March 12, 2007

Where:
TGI Friday’s –
111 Cesar Chavez St E
Austin, Texas 78701


Print-friendly pages require either code forking or magic tricks with CSS, right? Not with Rails. You barely have to modify your code to make this work. You will need to be using Rails’ web service support with respond_to blocks.

Fun part first. Just add a line to your respond_to block, like this:

1
2
3
4
respond_to do |format|
  format.html
  format.print { render :layout => "print" }
end

Next, you’ll need a layout for your print-friendly page. Create a new layout called print.rhtml, and create the associated print stylesheet(s). I’ll wait while you do that.

Now you’ll need to add a mime type for the print format. You can register a new mime type with your server. But a quicker way to do this is to add this line to your environment.rb file:


Mime::Type.register "text/html", :print

Make sure to restart your application so that the mime type is actually loaded.

Now the money shot – add a link to your new print-friendly page:


<%= link_to "Print this", {:format => "print"} %>

That’s it! No code forking, nothing too hard, and easy to maintain. And to top it all off, you get neat looking URLs like www.example.com/pages/123.print.


Did you know you can use a memory-based database to run your Rails tests? Compared to running tests against a regular database (PostgreSQL, MySQL, or SQLite), it’s much, much faster.

You’ll need SQLite (http://www.sqlite.org/, http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite) and the MemoryTestFix plugin (http://topfunky.net/svn/plugins/memory_test_fix/) from Geoffrey Grosenbach.

The instructions given are great, except if you use SQLite3, like me. If you do, you’ll need to make a small tweak to the memory_test_fix.rb file. On line 4, Simply change SQLiteAdapter to SQLite3Adapter. That’s it! Enjoy faster tests!

Linkage