For one of my project, I have a Project model where project are referenced by their, hum..., reference. I use this reference to create nice URL like /project/myproj. The referenced is stored in the database in upper case so I always needed to use project.reference.downcase in the link_to or url_for methods.

I just found out that if you define a to_param method for an object. This method will be called when the object is given as a parameter for a URL. So I added

def to_param

And now I can use url_for(:controller => "project", :reference => project)