Hi I have a simple rails question that I am simply unable to figure out. like the title says, I want to get my users controller show page to have the myapp.com/@username url but I don't know how to do this. My knowledge of routes must be fundamentally flawed.
my links now usually look like this:
<%= link_to "#{@user.username}", :controller => "users", :action => "show", :username => @user.username %>
obviously this is not ideal. I'd like them to look like this.
<%= link_to "#{@user.username}", user_path(@user) %>
but I don't know what to do. Nested routes doesn't seem to be the way.
my routes are setup like this:
map.connect '/:username', :controller => 'users', :action => 'show'
but this seemingly just allows me to do what I do now, doesn't let me actually route through there. Any suggestions? PS this is a rails 2.3.8 app.