Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

By Peter Cooper / June 16, 2006

Derek Haynes laments:

Auto-Complete is a great tool when it provides possible results BEFORE you finish typing. Unfortunately, using Rails’s included AJAX helpers to query the database as you type often results in a large delay before matches are returned.

There have been small hacks from several people to help resolve this, but Derek presents a simple local_auto_complete_field helper (with source to use right away) that lets you specify some pre-fetched results for the autocompleter to use right away. Read More

By Peter Cooper / June 16, 2006

I’ve noticed many readers are using, so this should come in handy. Someone has developed a Ruby script that uses the API to download all of your links, and then uses SQLite to put them into a local database, whereupon you can do whatever you like with them. I just gave it a try and it works well.

It lacks some spit and polish though, and will complain if you run it more than once a day (as it attempts to recreate the tables on the same database). While you can run it daily, it uses a new database for each day, which might also not be so great. Read More

By Peter Cooper / June 15, 2006

Peter Szinek has announced he’s going to write a series of articles on ‘screen scraping’ with Ruby (more accurately, extracting data from Web pages and other online sources) and has released the first article entitled “Data Extraction for Web 2.0: Screen scraping in Ruby/Rails“. He covers four basic scraping techniques, first using regular expressions, then HTree and REXML, then RubyfulSoup, and finally WWW::Mechanize. If you need to process shaky HTML sources from Ruby, read on.

The font used on his blog may seem a little painful to some readers, but he covers these main libraries and techniques pretty well. Read More

By Peter Cooper / June 14, 2006

KRJS is an extension to Rails views by Chew Choon Keat that helps provide a radically different mechanism for handling AJAX and RJS. He calls it “RJS without messing the views.”

Rather than use remote_form_for and link_to_remote, for example, you can create specifically named actions on your controller that use RJS to perform the relevant actions upon regular code, rather than clog your views up with JavaScript and AJAX snippets. For example:

<%= form_tag({:action => ‘submit’}, {:id => ‘form’}) %>
<%= text_field ‘account’, ‘login’, :id => ‘account-new-login’ %>
<%= submit_tag ‘Login’ %>
<%= end_form_tag %>

This code looks like a normal form, but with KRJS, when the form is submitted the on_form_submit action is called on the controller via AJAX. Read More

By Peter Cooper / June 14, 2006

Aidan Finn, a freelance Ruby on Rails developer in Ireland, has developed a quick guide to creating your own generators in Rails. Code generators in Rails are useful when you have similar patterns between controller in various projects, but aren’t ready to jump into creating a Rails Engine or plugin, or where such wouldn’t be relevant. Read More

By Peter Cooper / June 14, 2006

The RubyExamples page is a few years old now, but I just came across a great example which still works, and which demonstrates the intense power of Ruby. Please note that Justin Bishop deserves all the credit for this one.

Here’s the routine:

class RubyStock
require ‘net/http’
def RubyStock::getStocks(*symbols)

Using it is simple:

puts RubyStock::getStocks(“MSFT”, “IBM”, “GOOG”).inspect

=> {“GOOG”=>{“Name”=>”\”GOOGLE\”", “Price”=>”386.525″}, “IBM”=>{“Name”=>”\”INTL BUSINESS MAC\”", “Price”=>”76.93″}, “MSFT”=>{“Name”=>”\”MICROSOFT CP\”", “Price”=>”21.51″}}

Amazing! It returns within half a second on my machine, and I can’t believe the same scraping logic works after three years. Read More

By Peter Cooper / June 14, 2006

Idiomatic Ruby is an online presentation by Toby DiPasquale that goes through some of the more idiomatic features of Ruby, those that newcomers to Ruby might be confused by or overlook. It covers Modules and Mixins, Exceptions, Regular Expressions, Duck Typing, Iterators, method_missing, Continuations, Closures and Blocks, and is very concise and well put together.

If you have someone in your development team who isn’t quite up to speed with Ruby yet, this presentation can help it all make sense. Read More

By Peter Cooper / June 14, 2006


A couple of enterprising Ruby developers have put together a forum for Ruby and Rails developers called Rails Forum ( It’s very new, but the posts seem to be trickling through already. As with most forums, it’s a chicken and egg situation, but if you enjoy forums, consider signing up and contributing. It’s time the community had a large, bustling forum, as some newcomers find them extremely valuable. Read More

By Peter Cooper / June 14, 2006

O’Reilly has just released “RJS Template for Rails” by Cody Fauser, the god of RJS templates. RJS templates are used in Ruby to create a full AJAX experience. They let you adjust and add elements onto the current page without reloading by using nice, clean Ruby code, without getting down and dirty with JavaScript.

I’ve just bought the book and it’s 58 pages of goodness. I don’t work with RJS too often, so this guide is already opening my eyes to my techniques I wasn’t aware of before. If you’re developing Rails apps and aren’t intimately familiar with RJS, you need it. Read More

By Peter Cooper / June 13, 2006

Stefan Kaes takes a look at common performance problems with Ruby on Rails. He looks at:

  • session containment and storage
  • caching constants
  • optimizing finder queries
  • avoiding slow helpers

(As an aside, InfoQ is shaping up to be a great resource. It’s worth checking out from time to time.) Read More

By Peter Cooper / June 13, 2006

Pat Eyler of O’Reilly’s Ruby blog has interviewed James Gray of Ruby Quiz fame. James talks about how he was won over to Ruby via Perl 6, and how the Ruby Quiz has continued to explode in popularity.

(If you haven’t checked it out, the Ruby Quiz is a weekly Ruby programming contest. A new challenge is issued each Friday, and a few days later everyone chips in their solutions and ideas. All of this is then archived on the site, allowing anyone to learn some great Ruby tricks whenever they like. There are currently 82 quizzes to learn about, so enjoy.) Read More

By Peter Cooper / June 13, 2006

From the ever-productive Erik Veenstra comes AllInOneRuby, a “Just-in-Time and Temporary Installation of Ruby”. The concept is simple:

AllInOneRuby creates a compressed executable for Windows, Linux or Mac OS X (Darwin) that includes both the Ruby interpreter and the runtime libraries. Why? Because it’s sometimes not easy, or possible, or desirable, or allowed to do a complete Ruby installation. That’s where AllInOneRuby comes in. I always have a USB-memory stick with AllInOneRuby in my pocket.

I need to try this along with Platypus, and see if I can deliver a complete working Rails application as a ‘click and run’ application for regular users on OS X (and Windows, though not with Platypus). Read More

By Peter Cooper / June 13, 2006

Delynn Berry has developed a useful plugin called UserStamp. Whereas Rails has built in support for automatic columns such as created_at and updated_at, it doesn’t (quite rightly) support concepts such as created_by, as these belong in the application domain. It’s a commonly required feature though, and Delynn has done a great job of packaging it up.

This is also worth looking at if you want to get an idea of how to put a similar plugin together. Most Rails applications have similar requirements and packaging them up as plugins makes it a lot easier to manage. Read More

By Peter Cooper / June 13, 2006


Project RIDE-ME is a new, open source, IDE and development environment for Ruby on Rails (though it’ll work with just Ruby too, of course) on Microsoft Windows. Unlike most other Rails IDE attempts, it’s not based on Eclipse, and is designed to make life easy for coders migrating across from Visual Studio. It certainly looks nice, although the reports are that it currently lacks a debugger, Subversion support, and a few other things. Looks promising though, and I think this could become rapidly popular with those who aren’t keen on Eclipse.

It makes me think that if there were an IDE like this with a lot more features, the author could easily charge $50 for it, and it’d sell like hot cakes. Read More

By Peter Cooper / June 13, 2006


It makes me wish I could read Spanish, but MeneaRailes appears to be a clone of Digg, but focusing on Ruby on Rails articles (again, mostly in Spanish). It’s only a matter of time before someone makes an English version (I already tried, but I haven’t had the time to get it right, I’m afraid). So.. Spanish readers, enjoy! Read More

Recently Popular Posts