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

Author Archives: Peter Cooper

By Peter Cooper / August 11, 2006

100Dollars

It’s Ruby Inside’s first competition! Ruby Inside is desperate for amazing Ruby and Rails content to link to, so let’s get the ball rolling..

Ruby Inside is offering a top prize of $100 for blogging about Ruby or Rails this week. The winner will be drawn at random from all Ruby related blog posts linked to in a comment or trackback made to this very post only. To win, your post must demonstrate something interesting or new about Ruby that Ruby Inside users could find interesting. Any tutorial, insight, cool code example, etc, is eligible.

A single second prize of $15 is offered for just linking to this contest on your blog or forum. Read More

By Peter Cooper / August 11, 2006

Flizer-1

Feedalizer is a Ruby library that lets you easily scrape Web pages and convert them into RSS feeds. Some demo code that generates a feed: Read More

require “feedalizer”
require “time”

url = “http://sydsvenskan.se/serier/nemi/article101047.ece?context=serie”

feedalize(url) do
feed.title = “Nemi”
feed.about = “…”
feed.description = “Daily Nemi strip scraped from Sydsvenskan”

scrape_items(“option”) do |rss_item, html_element|
rss_item.link = html_element.attributes["value"]
rss_item.date = Time.parse(html_element.innerHTML)
rss_item.title = rss_item.date.strftime(“%Y-%m-%d”)

# This grabs the page for a particular strip and extracts the relevant img element
rss_item.description = grab_page(rss_item.link).search(“//img[@width=748]“)
end

output!
end

By Peter Cooper / August 11, 2006

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
:default => "%m/%d/%Y",
:date_time12 => "%m/%d/%Y %I:%M%p",
:date_time24 => "%m/%d/%Y %H:%M"
)

Richard Leonard demonstrates how to use the date formats that come with Rails, as well as how to override or add some of your own directly into Rails’ helpers on the fly. Read More

By Peter Cooper / August 11, 2006

Rubydebuggers

Scott Broson has reviewed four different Ruby debuggers and works out which is the best. Read More

By Peter Cooper / August 9, 2006

Mathew Abonyi has made available the initial release of PluginTestKit, his test kit designed to make implementing testing for plugins easy. If you’re actively developing plugins and bemoaning the lack of a decent test system, check it out. Read More

By Peter Cooper / August 8, 2006

Atomrxml

Scott Raymond’s useful Atom and RSS RXML templates for Rails have answers developers’ prayers many times. They’re easy to adapt for your own circumstances. Read More

By Peter Cooper / August 8, 2006

Continuing the Troll Of The Month feature, I came across this gold today: “Who are these mongrel Ruby developers?” by Peter Thomas, a Java developer. It was posted in late July, but as I’ve only just found it, and it came after July’s TOTM, it counts.

Of course, this award could be taken to be proving his entire point, which I think is reasonably valid. The troll award therefore, doesn’t go to Peter and his well explained argument, but to the first commenter on his post, ‘Mikael’, who has this to say:

These are children drawing on the walls with crayons with some crayon salesmen egging them on. Read More

By Peter Cooper / August 8, 2006

Aamp

Shane Vitarana, creator of Rails Stats, has released a new plugin, acts_as_most_popular. acts_as_most_popular adds a method for each column in your model’s table called most_popular_* that returns an array of the most popular entries within that column. For example, if you have 1000s of users in your user table, User.most_popular_names would return an array with the most popular names, as found in the name column.
Learn more here. This seems like the sort of thing that might eventually be useful as a Calculation of some kind. Read More

By Peter Cooper / August 7, 2006

Railsmodelgraph

Matt Biddulph demonstrates how to create a graph like the one above for your own Rails application’s models using a 18 line Ruby script and a GraphViz compatible graphing program (such as OmniGraffle that comes with the Mac – I’m sure other operating systems will have an equivalent). Read More

By Peter Cooper / August 7, 2006

Beautify

Tim Burks shows how to use a Ruby code beautifer written by Paul Lutus directly from TextMate to beautify your Ruby code with a single keypress. Ideal if you’re not consistent with the tabulation and spacing yourself! Read More

By Peter Cooper / August 6, 2006

Dzoneruby

Okay, the title is a little white lie. DZone is actually a Digg-like site covering all programming and development topics, but recently its Ruby section has become more popular than when I first checked it out a few months ago. With its focus on developers, DZone has a great feel, and I personally feel many of the features are better than those offered by Digg. If you have a Ruby article to promote, give it a try. Read More

By Peter Cooper / August 5, 2006

Datepicker

DatePicker is a cute date selector tool that’s been designed to work easily with Rails applications. That’s it. You can download the source and get going straight away from here. Read More

By Peter Cooper / August 4, 2006

RubyForIIS is a package that helps you set up the bindings between Ruby, Rails, and Microsoft’s IIS server system. Project founder, Boris Leenaars, says:

The purpose of the RubyOnIIS project is to create a consistent setup procedure and helper applications to make life easier when trying to get Ruby on Rails running together with the Microsoft Internet Information Server, a.k.a. IIS.

Find out more. Read More

By Peter Cooper / August 4, 2006

Simple “Send Email from Ruby” method – Using Net::SMTP to talk to the local SMTP daemon directly to send mail. Not elegant, but a useful quick hack.

Helper to Display Rails Flashes – A helper method that formalizes and simplifies the displaying of certain flash variables in Rails views.

Rails and Vim – A script to open an entire Rails project in Vim (searches through for models, controllers, etc).

Using Ruby hashes as keyword arguments, with easy defaults – Make your life (and methods!) simpler by merging in a set of default options with the supplied ones.

Ruby daemon library – A useful Daemon module to simplify the creation of daemons in Ruby (the daemons gem may be better for this in the long run though). Read More

By Peter Cooper / August 4, 2006

The great guys over at New Bamboo (a British Ruby on Rails development team) have launched a new blog and their first post is a tour through the testing methods available in Rails. It’s ideal for those who’ve fallen behind with their Rails testing knowledge or those who want to get up to speed quickly.

They cover unit tests, testing relationships, testing validations, show how to put CRUD tests together, and how to test HTML coming out of your app. All useful stuff, and as they say.. you never know when the brakes might fail. Read More