I have a controller that needs to render two different layouts depending on the current path, but otherwise performs all the same actions.
The routes for the controller are:
/bars /foos/5/bars
Both need to call the same controller. The rub, however, is that in my views I don't want to use logic everywhere to determine which named route to call depending on whether @current_foo is set (the id of the current foo). Right now I have many bars_url() and bar_url(@current_bar) routes - these should generate the proper route based on whether the current path is /foos/:id/ or just /.
The only solution I see is to override all the named routes for 'bar' in a helper, and include that helper in my application controller (since these routes are used in controllers as well), but that doesn't seem a clean solution.
Is there any way to do this?