I added each line of map.resources to the route file prefix value. So, it looks like this:
map.resources :subjects, :path_prefix => ':company'
I even added this line for default behavior
map.connect ':company/:controller/:action/:id'
which is not necessary (I believe) because all routes are processed using the resource method.
I get the: company parameter in my before_filter method in ApplicationController. Everything is working. But.
Is it possible to change the behavior of all * _path methods so that it defaults to the company value for all generated URLs using the value taken from the URL? For it to work perfectly, I would have to add the company value as a parameter for each _path method. I believe that this can be done automatically.
source
share