How Would you Mimic an Arbitrary Directory Structure with Rails Routes?

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-03-20T15:49:13Z Indexed on 2010/03/20 15:51 UTC
Read the original article Hit count: 143

I want to be able to map Google Docs' folder system to urls in my application and am just wondering how I can say "route, I want you to match an arbitrary set of nodes, and the last one is the file (or possibly a directory, I can check in the controller)".

So I could do things like:

www.mysite.com/documents/folder1/childfolderA/document
www.mysite.com/documents/root-level-doc

Can the routes.rb file do something like this?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes