I have an app that I want to have reflect a similar url style to that of github:
/:user/:project
I can do this directly through match but this pretty much undoes the usefulness of resources routing. Does anyone know of a good way to get rails to use the above style of url for certain resources without having to hack up every path?
I've looked at some of the slug stuff but this seems to leave the '/users/'开发者_StackOverflow中文版 part of the path in which is what I want to remove.
Thanks
What I use:
resources :users, :path => '' do
resources :projects, :path => ''
end
And override to_param method of User and Project, for example:
class User
def to_param
name.parameterize
end
end
精彩评论