Tuesday, March 15, 2011

How do I add something to each route in Rails?

Is there an easy way to add a permanent string to every route in a Rails app, given that I already have quite a few resources specified and don't want to refactor all into a namespace?

Can I do something along the lines of

map.root 'myappnamehere'

and have that string appended to the beginning of all routes? I realise that this is not how I implement map.root normally.

TIA

From stackoverflow
  • path_prefix?

    The Pied Pipes : cheers. It was buried right at the bottom of that doc!
    Samuel : You'll want to do map.with_options :path_prefix => "..." do |map| ... end to make it apply for all routes easily.
  • you should be add prefix

0 comments:

Post a Comment