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

By Peter Cooper / June 2, 2006

Stuart Halloway and Justin Gehtland of Relevance LLC have put together an online presentation called AJAX on Rails. It looks at AJAX, its relation to Rails, how Prototype works, and provides lots of great code examples. If you want to brush up on your whole AJAX and Rails knowledge, it’s worth looking at. A PDF version is also available. Read More

By Peter Cooper / June 2, 2006

An oldie but a goldie.. Kent Siblev had an issue with his Rails application ballooning to 150 megabytes of memory usage per process. He couldn’t figure out where the problem was, so he wrote a small plugin called MemoryLogging to check memory usage on each request (Linux only, I’m afraid). He found his problem within minutes and explains what was going on. Read More

By Peter Cooper / June 2, 2006

The creator of co.mments, Assaf Arkin, a Rails developer, has created a plugin that makes it easy to add a Undo feature to your Rails app. Instead of warning users about things simply let them do it, but give them the choice to undo afterwards. Assaf’s plugin doesn’t cover all the bases, but it’s easy to build upon for creating your own system. For deletion, for example, you’d want to come up with a way to keep the data floating around for a while. Read More

By Peter Cooper / June 2, 2006

Basic Ruby

Advanced Ruby

By Peter Cooper / June 2, 2006

This is a “short” Ruby on Rails reference. It’s goal is to give you an overview over the most used functions / methods / classes. It’s not a tutorial, but as a handy guide when you already know your way around.

The “InVisible Ruby on Rails Reference” is an excellent resource for all Rails developers. It covers models, controllers, views, HTML helpers, ActionMailer, session configuration, etc.. and it’s like the most ultimate, largest ‘cheat sheet’ for Rails. Lots of examples, lists, and references, all organized really well. This is a keeper.

UPDATE, June 6th! This Rails cheat sheet is also pretty good. Read More

By Peter Cooper / June 1, 2006

Sebastian Delmont has put together a great PDF presentation covering most of the different ways to find things with ActiveRecord in Rails. Excellent. Read More

By Peter Cooper / June 1, 2006

Tar2RubyScript is a tool that packages up your entire Rails application into a single tar file with a special loader so that users can get up and running with one click.

The next step is working out how to package up an entire Rails app, database, and WEBrick (or Mongrel) daemon into a single OS X .app folder so that you can distribute cool Web apps to run on people’s local machines. Snippets would be a great candidate for this. I’ll post more information when I figure it out! Read More

By Peter Cooper / June 1, 2006

In this photo, a Ruby script has found the license plate and marked it with a red box (source below).

Camellia is a powerful ‘computer vision’ library you can use from Ruby. It’s written in C, is cross platform, and offers lots of features like color conversion, warping, filtering, drawing, and labeling. Here’s the source code to find the license plate in the photo above:

require ‘rubygems’
require_gem ‘camellia’
include Camellia

# load picture alfa156.bmp

# consider only the V plane (red)

# threshold and encode

# labeling
puts “#{blobs.nb_blobs} blobs detected”

# draw rectangle on all detected blobs
blobs.each {|b| image.draw_rectangle(b.left,,b.left+b.width-1,,cam_rgb(255,0,0))}

# save the resulting picture

# find out the biggest blob
sorted=blobs.sort {|a,b| b.surface<=>a.surface}
puts “The bigger blob is at position (#{sorted[0].cx},#{sorted[0].cy}) and its surface is #{sorted[0].surface}”

Update – May 2007: Paul Battley has worked out how to get this all running on Mac OS X. Read More

By Peter Cooper / May 31, 2006


The creator of Ruby on Rails, David Heinemeier Hansson, has made the cover of Linux Journal. Of more interest is their impressive dedication to Ruby topics this month, another sure sign that Ruby is on the way up.

The nay-sayers have dismissed Ruby in the past, but if it isn’t higher than Python on the TIOBE Programming Community Index (popularity of different programming languages) by May 2008, I’ll eat my hat. Ruby is currently at #20 and Python is at #8. Read More

By Peter Cooper / May 31, 2006

Another new article in Bruce’s series shows you how to get DOM-friendly IDs from ActiveRecord. This is a solution nearly all Rails developers have implemented at some time or another:

<% @entries.each do |entry| %>
<li id=’journal-entry-<%= %>’>
<%= entry.body %>
<% end %>

But Bruce demonstrates a cleaner way.. Read More

By Peter Cooper / May 30, 2006

Bruce Williams has a great set of articles going on on his blog called “Rails Views”. Each one looks at a different aspect of Rails’ views and templates system and how you can use it in a cool or different way. You are bound to learn something or come up with some ideas on how to make your views more efficient (I sure have!). Here are some of the recent posts in the series:

  • Internal Plugins – Bruce demonstrates a great way to separate common functionality in your applications using plugins. Lots of food for thought here.
  • Helpers That Take Blocks – A look at creating your own helps that take blocks, like form_for or content_for.
  • Read More

By Peter Cooper / May 30, 2006

NArray is an Numerical N-dimensional Array class. Supported element types are 1/2/4-byte Integer, single/double-precision Real/Complex, and Ruby Object. This extension library incorporates fast calculation and easy manipulation of large numerical arrays into the Ruby language.

It’s impressive stuff, if you can understand the math. NArray lets you create arrays with any number of dimensions, and gives you methods that let you perform complex matrix math. There are some great demonstrations, including image resizing and image smoothing with the class. Or how about the Game of Life in under 40 lines of code? Read More

By Peter Cooper / May 29, 2006

Kevin Clark looked at his options for testing his RJS (Javascript templates for Rails) templates but wasn’t happy with the limited options, so he rolled his own testing system as a Rails plugin. It’s called ARTS (Another RJS Testing System) and is available here. It’s pretty neat, and if your app uses a lot of RJS templates, you’re going to want it. Here’s an example of a test using ARTS:

def test_create_rjs
xhr :post, :create, :post => {:title => “Yet Another Post”, :body => “This is yet another post”}
assert_rjs :insert_html, :bottom, ‘posts’
assert_rjs :visual_effect, :highlight, “post_#{assigns(:post).id}”

Here are some general examples of how powerful it is:

assert_rjs :alert, ‘Hi!’
assert_rjs :assign, ‘a’, ’2′
assert_rjs :call, ‘foo’, ‘bar’, ‘baz’
assert_rjs :draggable, ‘draggable_item’
assert_rjs :drop_receiving, ‘receiving_item’
assert_rjs :hide, “post_1″, “post_2″, “post_3″
assert_rjs :insert_html, :bottom, ‘posts’, “Here’s text from insert_html”
assert_rjs :redirect_to, :action => ‘list’
assert_rjs :remove, “post_1″, “post_2″, “post_3″
assert_rjs :replace, :bottom, ‘This is something to replace’
assert_rjs :replace_html, “This is something for replace_html”
assert_rjs :show, “post_1″, “post_2″, “post_3″
assert_rjs :sortable, ‘sortable_item’
assert_rjs :toggle, “post_1″, “post_2″, “post_3″
assert_rjs :visual_effect, :highlight, “posts”, :duration => ’1.0′

Technorati Tags: ,

Read More

By Peter Cooper / May 29, 2006

Tobias L├╝tke needed to migrate a database from one architecture to another but needed to copy the data across intact. To ensure that the format would be architecture agnostic, he’s created a plugin that dumps the data to YAML and then reloads it back into the database at the other end. It’s a simple rake task, and Tobi gives quick and easy instructions.

Technorati Tags:

Read More

By Peter Cooper / May 28, 2006

People who are considering Rails as a platform often ask what it’s integration with tools like HTTP authentication are like, often because that’s the way they’re currently solving certain problems. Up till now HTTP authentication has been something you’ve had to implement yourself, but now there’s a plugin. Install it like so:

ruby script/plugin install

And use code like this in your controllers:

class AdminController < ApplicationController
htpasswd :user=>"maiha", :pass=>"berryz"
htpasswd :user=>"maiha", :pass=>"7Et1Y7tCawx32", :type=>:crypted
htpasswd :user=>"maiha", :pass=>"berryz", :realm=>"Member Only"
htpasswd :file=>"/usr/local/apache/passwd/.htpasswd"

Neat, huh? Learn more in this interesting blog post about the plugin. Congratulations to maiha for such a useful plugin. Read More

Recently Popular Posts