Rails URL Params as Types
Code: , , ,
No comments

Yesterday I (belatedly) took my friend Nola Stowe‘s advice and picked up a book she tech-reviewed, The Rails Way by Obie Fernandez. It’s been a great read so far (about 85 pages in), and I just realized that routing is largely about type conversion.

Continue this post

Painless Upgrade to Rails 2.0
Code: , , , , , , , , , , ,
No comments

I spent a dead-easy 2.5 hours last night updating NearbyGamers to Rails 2.0. My svn commit message read (with links added here for convenience):

Continue this post

Logging Internal Server Errors
Code: , , , , , ,
No comments

A good rule of thumb for websites is that for every hundred users who runs into a bug, one will let you know. This is when the user can even recognize there’s an error because they get a big “500: Internal Server Error”. You might get more reports if you have a very small userbase who know you, but don’t count on it. You have to log errors if you want to find out about them, so here’s some code to do that in Rails.

Continue this post

Discussion URLs: Opaque, Usable, and Readable
Code: , , , , , , , , , ,
4 comments

I just wrote about Human-Readable ActiveResource URLs, and now I want to examine one example of them more in-depth. Discussion forum URLs have several conflicting goals:

Continue this post

Human-Readable ActiveResource URLs
Code: , , , , , , , , , ,
1 comment

I’ve got URLs on the brain this week. I started NearbyGamers using Rails 1.1 with just gamers and tags. I upgraded to Rails 1.2 (and liked it) , and added discussions after I updated to Rails 1.2. I was able to use ActiveResource for Discussions with Posts as a nested resource. I’m really happy with this code, as it’s very tidy.

Continue this post

Rails: Semicolons Out, Slashes In
Code: , , , , , , , , ,
1 comment

As of r6485, Edge Rails resource routes use / as the URL separator for actions instead of ;. This will be in Rails 2.0 (and I like / more), so I wanted to get prepared for the change by updating my URLs now. I didn’t want to move to Edge Rails (too exciting for me), so I grabbed the change, dropped it into a source file, and loaded it into my app (thank you, open classes).

Continue this post

Add Feed Discovery Links Easily
Code: , , , ,
Comments Off on Add Feed Discovery Links Easily

I’m working on discussion forums for NearbyGamers and I’m building the first feeds into the site. I worked up a clean way to add them from my controllers similar to my tidy stylesheets code. Here’s how to do it.

Continue this post

Colorizing Rails Test Output
Code: , , , ,
No comments

I love making things easier to read, to skim, to take in at a glance. At last night’s the ChiRb presentation on rspec I noticed the output was nicely colorized.

Continue this post

Rails 1.2.1 Impression
Code: , , , ,
5 comments

I’m updating NearbyGamers to Rails 1.2.1. Nothing broke except my use of assert_tag in my tests; it’s been long-regarded as squicky and has been replaced with assert_select. As I’m tidying up some deprecated code, it occurs to me that this makes for an interesting example of how I feel Rails is changing.

Continue this post

Announcing NearbyGamers
Biz: , , , , ,
1 comment

I’d like to invite you all to check out my newest project, NearbyGamers, a service for tabletop gamers to find other players. (As I mentioned earlier, it’s a Rails site.) It’s for people who play RPGs, CCGs, TCGs, wargames, board games — basically any game where you need to have a live human on the other side of a table if you want to play.

Continue this post