Rails blogging contest

Pat Eyler is running a Ruby blogging contest, sponsored by Apress, and the first month’s topic is Rails Revelations: How Rails made me a better programmmer. Read the requirements at that post, and then write up your article and post a link to it in the comments here. Pat Eyler, Apress editor Jason Gilmore, and Jarkko Laine will judge the entries, picking a winner in February. Go to it!

Hackfest 2007 and CD Baby sprint

Ah, Portland. The open-source motherland. Pacific springtime beauty. RailsConf ’07 nirvana.rb # => true and home of CD Baby, a little record store that digs Ruby and Rails.

We’re gearing up for a RailsConf hackfest at the Jupiter hotel just down the street and figured, heck, let’s start now! The top twenty Rails contributors between the new year and conference registration opening day will have a free conf pass and a room at the Jupiter specially reserved, CD Baby’s treat.

No kidding. Registration opens in a matter of weeks. Sprint!

Rails contribution is measured by real Trac activity weighted in favor of well-tested, committed patches but also accounts for new tickets and even comments. We’re joining forces with Working With Rails to track Rails contributions from the new year onward. To be included, mark yourself as a core contributor and give your Trac username in your account profile.

Have a Rails itch you’ve longed to scratch? Now’s the time! Happy hacking, and see you at RailsConf.

Update: Derek @ CD Baby’s announcement with more details.

Update: I announced contest close on the opening day of registration but Derek announced an earlier deadline on January 22nd. Sorry for the confusion! To draw a reasonable compromise, the contest closes tonight, January 24th, at midnight PST. (That’s 2007-01-25 08:00:00 UTC.) After the contest closes, we’ll continue scoring the backlog of patches submitted before the deadline then announce the winners this weekend.

So far, 258 participants have opened 443 tickets, submitted 501 patches, and made 2976 changes. Congratulations! And the leaderboard’s still tight with 17 hours to go..

Update: the contest has closed. The winners are..

Capistrano 1.3.1

I’ve been remiss in announcing recent Capistrano releases, so I’m making up for lost time now. Capistrano 1.3.1 is now available!

Capistrano, for those of you that are late to the game, is a utility for executing commands in parallel on multiple remote machines. It comes with support for vastly simplifying the deployment process of Rails applications, but can be customized to work with virtually any environment.

Since 1.2.0, the following enhancements and changes have been made:

  • You can encode the username and port for a host in the host string. Does one machine require a different user than another? A non-standard port for SSH access? It’s as simple as:
role :app,  "app1.host.com"
role :web,  "webuser@web1.host.com"
role :db,   "db1.host.com:1234"
role :file, "fileuser@file1.host.com:1234"
  • You can pass an :as option to sudo, to specify which user a command should be run as:
sudo "spinner", :as => "app"
  • If you define a “.caprc” file in your home directory, Capistrano will automatically load that file on every invocation. (It has the same format as any other Capistrano recipe file.)
  • Assets in the images, javascripts, and stylesheets directories are now touched after updating the code, to ensure that Rails’ asset timestamping feature works correctly.
  • Make sure new setups and checkouts are group-writable.
  • Do not run the cleanup task on servers marked “no_release”.
  • Rake integration is now deprecated. You should be invoking ‘cap’ directly. A future release will remove rake integration altogether.

Feel free to read the changelog several other fixes and tweaks. It might be a few hours before the 1.3.1 gem reaches all the mirrors, but when it gets there, a simple “gem install capistrano” ought to do the trick!

DailyKos considers Ruby on Rails

Earlier this week, Hunter, uber technocrat at DailyKos.com started talking about how they will build the next version of DailyKos. The discussion has been going for a day or two now with over 700 comments as I write this.

While DailyKos is the highest-traffic political blog in the US, I don’t think it’s particularly newsworthy that they are considering Rails. In fact, I think it’s quite the opposite. What I do find interesting is the evolving discussion about the choices. Hunter essentially set out Perl/mod_perl, Python/Django and Ruby/Rails as the main choices. What people have to say about the differences and why they would choose one over the others makes for some really I-should-have-been-in-bed-an-hour-ago reading. Some of what people think they know about Ruby and Rails seems to be out of date or otherwise misinformed, but there are some good arguments on all sides.

If you are gearing up to have a conversation with management about picking Rails for a big project, take a read to see in one place all the arguments you will have to deal with!

Rails 1.2: Release Candidate 2

This is it. We’re a mere two shakes of a lamb’s tail from releasing the final version of Rails 1.2. But before we light the fireworks and pop the champagne, we’ll just do one itsy, bitsy, tiny test run. Like wearing protection glasses in downtown Copenhagen on New Year’s. You know, just for precautions.

So please do give it a good run. We’re looking for STOP THE BOAT and HOLD THE PRESSES kind of issues for this one. Nothing else will stop it (but please do report every thing you find any way).

For a reminder on how to install and what’s new, see the release notes for Release Candidate 1. We also did a series of highlights for Active Record, Action Pack, and Active Support. Read those and hold your breath in anticipation. Unless a surge of heinous issues appear, we’re expecting the final version to land some times next week.

Yay, hurray!

Using custom mime types

So, you’ve started using Rails’ new mime type support with responds_to, but you were wondering how to add your own custom types? Luckily, Geoffrey Grosenbach (aka topfunky) is there to show you the way. His example involves registering an extension for .png, and generating a custom icon for an order in his shopping cart with some RMagick-fu. His example looks something like this:

Mime::Type.register "image/png", :png

# then in your controller action
def show
  respond_to do |format|
    format.html { }
    format.png { }

Mime::Type.register will add the image/png mime type to the collection of mime types, bind it to the .png extension. It also creates a special Mime::Type instance at Mime::PNG. Check out the great post and the comments for more tips on caching and RMagick.

Note: After some investigation, I’ve found that using Geoff’s :format hack is not required on Rails 1.2 if you make the request with the :format parameter. Using routes like formatted_post_path(@post, :xml) will give you a path like “/posts/1.xml”. Accessing that will write public/posts/1.xml, regardless of what the page_cache_extension is.

A brief introduction to Active Resource

Rick Olson is getting jiggy with Active Resource these days and decided to spread the love with a brief introduction to the newest member of the Rails framework family. He takes you through how to use ARes as a client for the Beast forum in a few simple steps. Get your REST face on and enjoy.