This Week in Rails (September 24, 2008)

Welcome to the sixth addition of This Week in Rails, where we’ll take a look of the past two weeks of innovation in the Rails community. If you’d rather listen to this content on your ipod with additional Ruby news, check out the Rails Envy Podcast #47 and #48.

The Rails Guides Hackfest is in full swing, improving the Rails documentation by leaps and bounds. Rails Routing from the Outside In by Mike Gunderloy is a great read if you’re ever confused by Rails Routing. If you want to help with the Guide hackfest, there are several guides up that you can help review.

If you ever need to build a website which allows users to upload videos and then needs to encode them, definitely check out Panda, an open source video encoding application which uses EC2, S3, and SimpleDB. The application itself is written in Merb, but it’s designed to run separately on ec2 and can easily integrate with your rails app on the front end.

If you’d like to ensure your Rails application is well written, Matt More wrote up a Rails Code Quality Checklist which serves as a great guide to Rails best practices. Also, if you need help discovering where your code might need a little re-factoring check out Roodi a new gem by Marty Andres that gives you instant feedback about your Ruby code by examining a few metrics including cyclomatic complexity, method length, bad method names, and blank blocks or loops. Lastly, if you’ve been following the “skinny controller, fat model” best practice, you may have found yourself with really fat models (not so good). Paul Barry suggests one way to deal with this using concerned_with.

If you’re about to start a new Rails application then you might consider using Bort, a Rails starter application from Jim Neath. Bort contains RESTful Auth, Will Paginate, Exception Notifier, Asset Packager, a Capistrano Recipe, and everything is tested by RSpec. If you’d rather start your system with email login instead of username, Matt Hall put together a fork of bort for this.

Implementing a page with multiple file uploads in Rails is no easy task. Luckily, Brian Getting wrote up a tutorial which makes it look easy.

Clemens Kofler wrote up a Guide to Memoization which walks through all the details of this convention and looks at the new “memoize” helper in Edge Rails ActiveSupport. If you don’t know what this word means, please do take the time to read his tutorial.

If you’ve ever developed a plugin, you may have just decided to manually run your tests every time you change your code. Last week Ken Collins recently put out a new library called Autotest Railsplugin which makes it dirt simple to run autotest on plugins you’re developing.

Lastly, if you’re looking for other Ruby/Rails podcasts, check out the Rails Podcast which recently featured Jim Weirich at erubycon, Rubyology which recently interviewed Avi Bryant, the Learning Rails podcast which recently covered how to deploy your rails app, Railscasts which recently covered starling and workling, and the Rails Brazil Podcast if you speak Portuguese.

That’s all for now. If you create or discover any notable tools or blog posts this week, feel free to send me an email (Gregg@RailsEnvy).

Image Credit: Still on the right track by janusz l

This Week in Rails (September 10, 2008)

Welcome to the fifth edition of This Week in Rails, a weekly report with highlights from the Rails community. Antonio Cangiano (the original author) has been pretty busy, so I figured I’d step in this week.

As you probably already know, Rails 2.0.4 and Rails 2.1.1 were released this week. Both are mostly bug fixes, but checkout the changelog if you want all the details.

If your Rails app has alot of heavy duty SQL Queries you may want to take a look at a plugin by Fernando Blat called Query memcached. This plugin overwrites Rails default query cache functionality, storing all database queries in memcached for use by sequential requests.

Have you ever implemented an advanced search page for a Rails application? If yes, you may have ended up with bloated controller code. One solution to the problem is Searchgasm by Binary Logic which helps you do object based searching, and keep your search code clean and simple.

Ryan Daigle told us about some great new features in Rails Edge, including Connection Pooling, Shallow Routes, and Mailer Layouts. We should be getting a Rails 2.2 beta any day now, so stay tuned for that.

If you have any Java friends who use Apache Derby who are looking to try out JRuby, Michael Galpin wrote up an introduction to Rails using JRuby and Derby.

Last week Mark Imbriaco from 37 Signals put together a great blog entry and screencast which shows how they use HAProxy in their server setup. If you’re not familiar with the benefits of using HAProxy over the apache round robin load balancer, you need to watch his screencast.

Perhaps you’ve started using jQuery instead of Prototype for Rails. You might have used a plugin for this (ex. jQuery on Rails), but if you started from scratch you might have run into that problem with sending authenticity tokens with your AJAX requests. Lawrence Pit posted the jQuery code you’ll need to take care of this.

Neverblock is a library that allows you to use Ruby Fibers to write non-blocking concurrent code. This project recently released a non-blocking PostgreSQL adapter, a non-blocking MySQL adapter, and most recently got their Fiber library running on Ruby 1.8 with Rails with some amazing benchmarks! It’s still a very young project, but it’s one more step towards a safely multi-threaded Rails stack.

Lastly, I’ve got some events to tell you about. Ruby DCamp is taking place October 11th-12th in Arlington, VA, the Rails Summit Latin America is taking place October 15th and 16 in Sao Paulo, Brazil, and the South Carolina Ruby Conference is on October 18th in Columbia, SC.

Thanks for reading! If you would have rather listened to this information (with slightly more detail), you should check out the Rails Envy Podcast #46 which came out today. It’s no mistake that it’s covering the same material (I help with the podcast).

Guides Hackfest

I’m pleased to finally announce the Rails Guides Hackfests. And we got really exciting prizes too! There is a list of guides available at Lighthouse You can select one of those, update the ticket and start writing the guide straight away.

For each completed guide, the author will receive all of the following prizes :

You can find more details at

Special thanks to GitHub, Newrelic & Caboose documentation project for making the hackfest a lot more exciting!

Rails 2.0.4: Maintenance release

Thanks to Git it’s been a lot easier to maintain older branches of the code base, so we’ve taken the opportunity to backport a bunch of bug fixes to the 2.0 branch and here’s the release for that.

The only major issue is that we’ve fixed the REXML DoS vulnerability with a monkey patch that ships in the box. So if you’re on 2.0 and haven’t dealt with the issue already, you can upgrade to 2.0.4 and get it fixed.

You can install with: gem install rails --version 2.0.4

See all the changes

UPDATE: The actual 2.0.4 gem didn’t get published yesterday due to a bug in the release script. It’s been fixed and 2.0.4 is actually available on the main gem repository. Sorry about that!

Tell your Rails story

I’ve been receiving some very moving stories about how people came to be Rails programmers from incredibly diverse backgrounds over the years. I even talked to a taxi driver once who was taking me to the airport that was doing Rails. Or the guys who were looking to quit programming who started enjoying it again with Rails.

All these are powerful stories that I’d love if we could share with the world. So let’s try to do that! If you have a great story about how you came to Rails, then please send it to david at loudthinking dot com with the subject “My Rails story”. I’ll filter all those into a folder and we’ll find a way to publish them.

Juggernaut: Server-side push for Rails

Juggernaut is a combination of a small Ruby server, a Flash bridge, and a plugin that makes it easy to do server-side push systems in Rails. I played with this idea with Rich Killmer a few years ago and even made a small demo system to present at a conference, but never made it to the finish line of something releasable. So it’s fantastic to see that the guys behind Juggernaut did.