I’m trying to create custom URLs for my site’s users:
www.mysite.com/user1
If I set the routing rule to be this:
match ':id' => "user#view", :as => :user
Then it works great! I can access http://www.mysite.com/user1 and it will pull up the page for user1.
However, that breaks my about page, which is at http://www.mysite.com/about . The error I get here is:
“Couldn’t find User with id=about”
Any idea how I can fix this problem? Thanks! As an aside – I’m using friendlyid to generate the human readable slugs.
Ringo
Is the about page a static file located at
public/about.html? If so, then Rails will match this first and fall back to the router if it can’t find the file.If it’s a route instead, then your
match :idroute should be beneath the one for about, so that about is matched first.