mardi 10 novembre 2015

Rails - Add a route prefix to a specific directory

I have a messy rails 3 application that's come from a different developer and I need to refactor it.

What I want to do is move the contents of "app" into a subfolder called "classic".

app/classic

And then have all URL's with a classic prefix such as

localhost:3000/classic/wills/new

Route to controllers inside of the "app/classic" folder.

And then every regular url that does not contain the classic prefix - route in the standard way to app/

Is it possible to do this? The only thing I've discovered so far is that I can add a scope inside of my routes file.

scope(:path => '/classic')

But all that does is require a prefix for every URL. I'm really not sure how to go about this!

Aucun commentaire:

Enregistrer un commentaire