I’d like to create the following setup with RoR:
I’d like both urls to call the same action in the same controller. How
I do this? I know this may be complicated, but I’m prepared to go a
In your controller:
class SubDir::OrderController < ApplicationController
In app/views you have to create subdir directory to put the views
concerning this controller.
That approach won’t quite give you what your after. That approach
will put a controller in a subdirectory, sure, but from what you said
you want the same action and controller accessed from two different
To do this I would use routes. I don’t have a box with ruby on it in
front of me but from memory something like.
Should get you started. You can get very tricky with routes. Try
searching this list, along with the standard google, and doc search.
Sorry, I didn’t get that
Daniel N is right, routes is what you’re looking for.
Correct me if I’m wrong, but won’t this solution simply allow the order
controller to be called from one subdir? Lets say I do as you
class subdir1::OrderController < ApplicationController
This will give me the following url:
But I wan’t two urls to call the same controller/action:
How can I achieve this?
Thanks, I will check that out!