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

By Peter Cooper / December 5, 2006

Jamis-Find

Jamis Buck has put together a cool series of articles about ActiveRecord’s find method as used in Rails. He goes into a lot of detail about how find and its related methods work in terms of the internals of ActiveRecord. Jamis’ explanations are not only useful for Rails developers, but for anyone interested in patterns and how to structure code in Ruby. The Rails team don’t always do everything the ‘best’ way, but it’s usually tight, well developed code you can learn a lot from.

In the first installment, Jamis just presents a basic introduction to his series.

In the second installment, he leaps right in to the details of find and its child methods, find_from_ids, find_every and find_initial. Read More

By Peter Cooper / December 3, 2006

Scott Fleckenstein has developed a plugin for Ruby on Rails called Exceptional that ‘brings exception handling into the world of Rails filters’. The code speaks for itself on this one:

class SampleController < ApplicationController
handles AccessDeniedError,
:with => :access_denied,
:only =[:supah_sekret_akshun]

def supah_sekret_akshun

raise AccessDeniedError

end

private
def access_denied
render :text =’no, u kant’
end
end

There’s a bit more to it than that, so check out the official plugin site for examples and how to download the plugin. Read More

By Peter Cooper / December 3, 2006

A couple of days ago, Tim Lucas wrote a cool article called “instance_eval brings sexy back” where he demonstrated how to use instance_eval to improve the usability of the match method. The downside, however, was that Tim’s technique required manually defining accessor methods each time match was used.

Myles Byrne rapidly responded with a cuter solution:

class MatchData
def matchnames(*names)
names.each_with_index do |name, index|
self.instance_eval “def #{name}; self[#{index+1}] end”
end
self
end
end

time_components = /(\\d+):(\\d+):(\\d+)/.match(“17:00:34″).matchnames(:hours, :mins, :secs)
time_components.hours

I quickly realized, however, that I never use match in this way. I prefer to use String#match instead (Regexp#match doesn’t click to me, it seems back to front). Read More

By Peter Cooper / December 1, 2006

Radventday1

The Ruby Advent Calendar 2006 is all engines go! There’s an RSS feed available if you want to keep track of it, and a few days are still available if you want to write a day yourself. Read More

By Peter Cooper / November 30, 2006

There’s more about Amazon S3 and Marcel Molina’s hot new library coming as the first day of the Ruby Advent Calendar (this Friday!), so I don’t want to say too much about it yet. For anyone already enjoying this library, however, I put together a scrappy program that lets me copy files up to S3 from the command line easily:

#!/usr/bin/env ruby

require ‘rubygems’
require ‘aws/s3′

local_file = ARGV[0]
bucket = ARGV[1]
mime_type = ARGV[2] || "application/octet-stream"

AWS::S3::Base.establish_connection!(
:access_key_id => ‘REPLACE_ME’,
:secret_access_key => ‘REPLACE_ME’
)

base_name = File.basename(local_file)

puts "Uploading #{local_file} as ‘#{base_name}’ to ‘#{bucket}’"

AWS::S3::S3Object.store(
base_name,
File.open(local_file),
bucket,
:content_type => mime_type
)

puts "Uploaded!"

Just name it s3cp (or similar), chmod it, and then you can do stuff like:

s3cp ~/somefile.whatever bucket Read More

By Peter Cooper / November 28, 2006

I keep getting e-mails about job sites, Ruby jobs, and so forth, so I decided it’s time for a bumper “here are all the Ruby and Rails job sites” post! Enjoy..

2009 update: I’ve had to remove a few as they no longer exist any more – so there are not 6 here ;-)

First off: The Ruby Inside Job Board. There are lots of great jobs there – entirely up to date (as of August 2008) – vacancies from companies like TechCrunch, Scribd, and others. However, all the jobs on our job board are based in the United States only. Read More

By Peter Cooper / November 28, 2006

Jedit

Jim Morris declares that jEdit could be “Textmate for the rest of us“. jEdit will be familiar to many developers as a language agnostic IDE created with Java (though significantly less bulky than Eclipse!), but even I was surprised to hear this:

Yes JEdit actually has intellisense-like completion for Ruby. A previous blog entry of mine explained how I tried Komodo to get this, but it was not very good, however the JEdit version found in the latest RubyPlugin, works pretty well, I think it uses parsing from the JRuby project, so no surprise it works.

Morris continues to explain how he has developed macros for jEdit to replicate numerous TextMate features, such as expanding # to #{} when typing within a string and points to other macros to get a TextMate-like experience for free. Read More

By Peter Cooper / November 23, 2006

Railslogo

It’s only the first release candidate, but the Rails 1.2 gravytrain is now pulling into the station. The biggest new features include the full suite of REST goodies, a freshly-written Routing system, and significantly improved Unicode support.

An aside: I am wondering whether news such as this, which was already posted to the popular official Rails blog, should even be posted to Ruby Inside. I assume all Ruby Inside readers, if interested in Rails, would already be reading some of the important Rails blogs out there.. or are there people who only read Ruby Inside for their Ruby / Rails news? Read More

By Peter Cooper / November 22, 2006

Eughnice

It seems a few people share the opinion that RJS can prove to be a little abstraction too far sometimes, and would rather just code in JavaScript with the occasional bit of RJS embedded in. Now they have their wish. Dan Webb has created “RJS Minus R”, a Rails plugin that takes the R out of RJS. Even David Heinemeier Hansson gives it a careful thumbs up.

(Found via Dr. Nic Williams) Read More

By Peter Cooper / November 21, 2006

Allison

Allison is a new RDoc template produced by Evan Weaver. I’m not entirely sure about the colors (but these are easily tweaked with CSS), but it still looks very nice and clean, and for many situations is an obvious improvement over the default framed template RDoc provides. Evan provides full instructions for using Allison for your documentation. Read More

By Peter Cooper / November 21, 2006

Ram

RAM: Ruby Asset Manager is an open source project that provides a ‘digital asset manager’ written in Ruby on Rails. It has a slick interface and there’s a live demo you can play with right away, as well as the obligatory page of screenshots and screencasts demonstrating features such as Web-based multiple file upload, bulk download, group based roles, and password protected RSS feeds.

It looks and feels like a pretty solid Rails application, so it might be worth diving through the source code for any goodies, or even to learn how a big project involving front end, administration, and feed interfaces with role-based authorization is put together. Read More

By Peter Cooper / November 20, 2006

Gp2X

The GP2X is a Linux based handheld games console that’s based on open source technologies. It’s commonly used for running emulators to play games from older systems, but is also a powerful device in its own right (it features a 200MHz ARM processor).

Fujeyla-Studio has put together a statically compiled Ruby interpreter along with the RubyGame SDL extension for the GP2X, making it easy to develop games for the handheld. I don’t have a GP2X but the source code I saw within the package looks like standard RubyGame fare. Might have to look into getting one of these devices! Read More

By Peter Cooper / November 20, 2006

Pror

Pratik Naik of Thinkwares (an Indian Rails development house) wrote to me to announce the launch of PlanetRubyOnRails.com, an automatic ‘river of news’ style aggregator of Ruby and Rails blogs. If it sounds familiar, it’s because PlanetRubyOnRails.org has been doing the same for a while now, but, as Pratik explains: “One of the main reason why we did it is because planetrubyonrails.org is maintained by noone. I had changed my blog address and I couldn’t get it changed there.”

There’s a little innovation too. PlanetRubyOnRails.com supports dynamic subdomains so that you can narrow down on the sort of posts you want to read. Read More

By Peter Cooper / November 19, 2006

Symbian

While there have been attempts at porting Ruby to the Symbian (mobile devices) platform before, Symbian have now released an official build of Ruby for Symbian OS (S60 to be precise). This brings Ruby to a vast universe of cellphones. Symbian are providing the project with libraries for rendering, messaging, and persistence on their platforms. Read More

By Peter Cooper / November 17, 2006

Workingwithrails

DSC, a London based technology consultancy, has today launched Working With Rails, the biggest index of Ruby on Rails developers seen on the Web so far. Quietly launched to a small group of developers several days ago, the site has now gone live for everyone to play with.

I caught up with DSC developer Martin Sadler to learn a little more about the site.

Ruby Inside: What was the motiviation behind developing WorkingWithRails for DSC?

Martin Sadler: At DSC we tend to use Ruby (on Rails) for the majority of our projects and so it seemed fitting that we contribute back in some way for all the benefits ROR has given us. Read More

Recently Popular Posts