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

Author Archives: Peter Cooper

By Peter Cooper / September 23, 2006

Mysqlanalyzerplugin

Bob Silva has put together a fine MySQL query analyzer plugin for Ruby on Rails. It uses MySQL’s EXPLAIN command to analyze all of the different SQL queries made by your Rails application (or, more accurately, by ActiveRecord!) and gives you the information you need to add better indexes (or add any extra indexes at all!) and could help show where a little custom SQL could silence a squeaky wheel. Read More

By Peter Cooper / September 21, 2006

Eric Hodel has looked at a new feature provided by Ruby 1.8.5 called Process::setrlimit. It makes it easy to limit the memory usage of your Ruby processes.. ideal if you’re experiencing memory leaks! Eric shows an example that’s as simple as adding this to your application’s environment.rb file:

Process.setrlimit Process::RLIMIT_RSS, 1024*1024*150, Process::RLIM_INFINITY

Of course, this isn’t a Rails only feature. Read More

By Peter Cooper / September 21, 2006

This month’s “Troll of the Month” is Ruby vs Python – why no-one should care by Cynos. Cynos touches on a point I’ve seen raised a few times in the past month.. namely that Python and Ruby are similar and are, supposedly, ‘converging’. He argues, therefore, that both communities should stop evangelizing to each other. Despite a reasonable, if baited, argument, however, the comments quickly turn into a pointless flamewar:

- and when you unfairly malign nice people because of the programming language that they use [...] that I can only assume you’re a born again Ruby user

- I don’t really care about either language, but if I had to pick one I’d go with Python. Read More

By Peter Cooper / September 20, 2006

The Rails Forum has announced a Rails Tutorial contest:

To celebrate our 500 member mark obtained yesterday, and in the interest of getting more good Ruby on Rails tutorials, Rails Forum is giving away an iPod shuffle to the best tutorial written between now and 12:01 AM GMT on November 1, 2006!

What do I need to do to enter?

Simple! Just post a tutorial in our Ruby on Rails Tutorials forum between now and the time above, and you’ll be automatically entered!

To learn more, read the announcement post. If any good tutorials end up on there, I’ll be posting references to them here on Ruby Inside.. Read More

By Peter Cooper / September 20, 2006

Mnlrb

Mr. Neighborly (a.k.a. Jeremy McAnally) has just released his “Humble Little Ruby Book“, a Ruby book available in both e-book (PDF) and print formats. The book is a bargain basement $5 as a PDF or $10 in print! Much like Why’s Poignant Guide, the Humble Little Ruby Book is written in a conversational style and has a real ‘atmosphere’ about it. It covers the Ruby language from the very basics through to creating useful and functional programs. Read More

By Peter Cooper / September 18, 2006

Railsforumbuttons-1

Kelli has posted four different Rails buttons on the Ruby on Rails Forum (shown above) that you can use anywhere you like.

In the same spirit, I’ve put together four “Ruby Inside” graphics you can also use where you like. They’re not ads for this blog, so you don’t have to link back to here with them (though you can if you like!) but they’re more to demonstrate that Ruby is in action on whatever you use them against. Like “Intel Inside”, etc.

Big JPEG:
Rubylogo

Big PNG (transparent – will work on any color background):
Rubylogo

Small JPEG:
Rubylogosmall

Small PNG (transparent):
Rubylogosmall Read More

By Peter Cooper / September 17, 2006

Actsascachedshot
acts_as_cached is a plugin by Chris Wanstrath, Tim Myrtle, and PJ Hyett that simply allows you to cache any Ruby object in memory (using memcached). Check out the documentation for the full instructions, but if you’ve got a working memcached server ready and waiting, it’s as easy as installing a gem (memcached-client), a plugin (acts_as_cached), and adding ‘acts_as_cached’ to your model.

Chris gives a full run down of acts_as_cached in this blog post, and also links to a great PDF presentation about the plugin. Read More

By Peter Cooper / September 16, 2006

Railsconfeu2006

DHH has put together a great round-up of RailsConf Europe 2006 that took place over the last couple of days. He also announces that RailsConf Europe 2007 will be in Berlin, Germany. Read More

By Peter Cooper / September 15, 2006

Newrubysite

A few readers have e-mailed in pointing out the new official Ruby site’s design. It’s a great bit of work, but I tend not to post about things that everyone’s almost certainly read somewhere else, and I linked to a preview of the new design some time back. However, I just noticed they’ve mentioned Ruby Inside as one of only four Ruby ‘blogs of note’. As a thanks for this great honor, I realized I should probably post about the site, so go enjoy it. Read More

By Peter Cooper / September 15, 2006

Ajaxscaffolding

Richard White quotes an anonymous user of his AJAX scaffolding system for Rails:

I really like Ajax Scaffold but it’s really hard to upgrade when a new version comes out. I usually spend a couple hours diffing all my scaffolds with a newly generated one.

Richard listened, and no longer are you forced to use AJAX Scaffold as a code generator.. it’ll now work as a regular Rails plugin! Richard has more information here. Nice work, Richard! Read More

By Peter Cooper / September 14, 2006

Ryan Daigle writes about resource_feeder, a new plugin for Ruby on Rails that makes the generation of RSS and Atom feeds easy. Like so:

def rss
render_rss_feed_for Post.find(:all, :order => ‘created_at DESC’, :limit => 10)
end

If you want to get playing straight away: Read More

script/plugin install simply_helpful
script/plugin install resource_feeder

By Peter Cooper / September 14, 2006

Radrails

The latest version of RadRails, the Ruby on Rails IDE, 0.7.1, has been released for Windows, OS X and Linux. Some fixes to the reliability of starting and stopping servers from the IDE have been made, and some refactoring has taken place. The “Terminal” view has been replaced by a Console view which all generators, rake tasks, plugins, and other scripts outputting to stdout will use. A configuration preferences pane has also been added, making it faster to start new projects. Read More

By Peter Cooper / September 14, 2006

HAML is a new template language for Ruby on Rails developed by Hampton Catlin, a Canadian Rails developer. It’s a high-level, heavily semantic language that breaks the mold of RHTML and makes it very hard to make markup errors. In a way similar to Python, HAML relies on indentation, which it uses to enforce DOM hierarchy.

Here’s an example of some HAML code in action:

!!!
%html
%head
%title Client Admin Site
%meta{“http-equiv”=”Content-Type”,
:content=”text/html; charset=utf-8″}/
= stylesheet_link_tag ‘tabbed’
= javascript_include_tag ‘tabbed’
%body
#application
#header
.container
.statusbar
.logo
%strong Admin Interface
.menu= link_to ‘logout’,
:controller =’account’, :action =’logout’
%br{:style=”clear:both;”}/
.tabs
%ul.navigation
%li= link_to ‘Member Approval’, member_admin_url
%li= link_to ‘User Management’, user_admin_url,
:class =’selected’
%li= link_to ‘Pages’, page_admin_url
%li= link_to ‘Reports’, reports_url
%li= link_to ‘Help’, ‘/’
#page
#content
//These will only render if there is
a non-false value returned from the helper
#errors= print_flash(:error)
#notice= print_flash(:notice)
= @content_for_layout
#sidebar= @content_for_sidebar || false
%hr/
#footer
%p= “Copyright Hampton Catlin 2006″

Learn more in this article. Read More

By Peter Cooper / September 13, 2006

Geekupschedule

GeekUp is a community of developers in the North-West of England (a fine place by any measure) and they’ve put together a FREE, one-day mini conference about Ruby and Rails in Manchester. The event is limited to 40 people and is aimed at newcomers to Ruby and Rails. (If you’re wondering how to get there, take t’buzz to top o’hill ‘n than walk down’t'other side.) Read More

By Peter Cooper / September 12, 2006

I want to look at the history of the BASIC language, the uptake of novice programmers, and how Ruby could capitalize on them in the future. Read More