# Match the subdomain to the useraccount r.match(:username => /^\w+\b/) do |user| user.match("/:permalink").to(:controller => 'projects', :action => 'show') end