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

Author Archives: Peter Cooper

By Peter Cooper / June 6, 2006

Rcookbook
Inspired by the legendary (amongst Perl programmers anyway!) Perl Cookbook, comes the Ruby Cookbook. It has the equivalent examples from the Perl Cookbook but in Ruby form, of course. The basic sections are mostly complete, although some of the later sections are barely covered yet. Still, if you want to see the basic recipes for dealing with strings, numbers, dates and times, arrays, hashes, file I/O, process management, and so on, it’s a cute little resource. Read More

By Peter Cooper / June 6, 2006

Rav
There’s been talk about producing something like this in the Rails community, and it seems someone has finally done it.. a Rails Application Visualizer. Simply run a rake task and it produces a graphic showing your models and how they relate to one another. It requires the GraphViz library to run, and is only in its early days. Looks promising though! Read More

By Peter Cooper / June 6, 2006

You might have noticed this blog has nice, syntax colored code excerpts, as does Code Snippets. Jim Morris looks at how you can pull this off in a few different ways. One quick and easy way is to use syntax.carldr.com, a Web site that converts any Ruby code you paste into the correct syntax colored HTML. Currently I use TextMate and an external script using the syntax gem, but might use that site instead as it’s easier! Read More

By Peter Cooper / June 5, 2006

Rail Mail is a Rails plugin by Scott Fleckenstein that stores copies of any mail that your Rails application sends, and provides an interface to view it. Read More

By Peter Cooper / June 5, 2006

Aidan Finn has written what may be the most comprehensive walkthrough of developing an authentication system in Rails. He starts from the migrations and covers every step of the process, right through to the tests. If you want to see how a Rails developer produces an entire block of functionality from start to finish, this is worth reading. Read More

By Peter Cooper / June 5, 2006

Neighborly

Jeremy McAnally is writing a Ruby and Rails book called “Mr. Neighborly’s Ruby and Rails” and what an interesting book it’s turning out to be. He’s going to sell the finished item for $14 as a print book, $9 as an ebook, and it’s due to be finished in the next few months. For now though, you can download the first chapter for free. It’s a really cool introduction to Ruby, ideal for existing programmers or Rails developers who don’t know much Ruby yet.

The fonts and the feel are really ‘olde-worldy’ and I’m thinking this could be a big hit. Read More

By Peter Cooper / June 5, 2006

A few days ago I learned about Curvy Corners, an incredible JavaScript that lets you put rounded corners on your DIV elements that can do anti-aliasing and handle any size border. It’s the best rounded corner script so far.

Craig Webster saw it too and has created a Curvy Corners in Rails helper method that means you can do stuff like:

<% curvy_div(:tl => false, :br => false) do -%>
Oyy, stylish.
<% end -%>

Very neat. Read More

By Peter Cooper / June 4, 2006

Railshelp
RailsHelp.com has possibly the simplest homepage in the world. Just type in what you’re searching for, and off you go. It’s a nice change to digging through the regular API documents. Read More

By Peter Cooper / June 4, 2006

If you’re on Windows and have been having trouble with your database adapters, this post about new Ruby database adapters for Windows might just be for you. Now, back to TextMate… :) Read More

By Peter Cooper / June 4, 2006

A few months ago I was getting fed up of having to create new ActionMailers from scratch on my Rails applications, so I decided to come up with a ‘generic’ way to cover all the bases. Instead of creating multiple mailers, you create a single mailer and append generic methods. The content goes to the regular RHTML files and you send through whatever you want from your controllers. See Simplifying ActionMailer development in Ruby on Rails. There’s probably a lot that could be done to it now, but it works great for me.

An example ActionMailer class: Read More

class Mailer < ActionMailer::Base

helper ActionView::Helpers::UrlHelper

def generic_mailer(options)

@recipients = options[:recipients] || “me@privacy.net”
@from = options[:from] || “me@privacy.net”

@cc = options[:cc] || “”
@bcc = options[:bcc] || “”

@subject = options[:subject] || “”
@body = options[:body] || {}

@headers = options[:headers] || {}
@charset = options[:charset] || “utf-8″

end

# Create placeholders for whichever e-mails you need to deal with.

By Peter Cooper / June 4, 2006

Settings is a new plugin for Rails that lets you have a basic hash of ‘settings’ or configurations for your application without having everything hardcoded. Example: Read More

Settings.admin_password = ‘supersecret’
Settings.date_format = ‘%m %d, %Y’
Settings.cocktails = ['Martini', 'Screwdriver', 'White Russian']
Settings.foo = 123

By Peter Cooper / June 4, 2006

Learn-Ruby-App
Rodney Ramdas has put together a small application called “Learn Ruby” that shows the freely available version of the Pickaxe Ruby book alongside an instance of irb, meaning you can work through the examples and tutorials more freely. Note that it’s for OS X only.

If you want something similar, but which lets you use a Ruby interpreter direct from your Web browser, try out why’s infamous and incredibly clever Try Ruby! Read More

By Peter Cooper / June 4, 2006

RailsTidy is a plugin for Rails, by Damien Merenne, which validates your RHTML templates, the HTML output from your functional tests, and tidies up the HTML generated by Rails. Read More

By Peter Cooper / June 4, 2006

It’s a few months old, but this guide to creating your own role based authentication system in Rails is pretty good. It doesn’t use any plugins other than the LoginGenerator. Read More