Hi, I''d like to create the following setup with RoR: www.mywebsite.com/subdir1/order/create www.mywebsite.com/subdir2/order/create I''d like both urls to call the same action in the same controller. How can I do this? I know this may be complicated, but I''m prepared to go a long way. Shimon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060712/1a3c68a0/attachment.html
In your controller: class SubDir::OrderController < ApplicationController end In app/views you have to create subdir directory to put the views concerning this controller. On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote:> > Hi, > > I''d like to create the following setup with RoR: > > www.mywebsite.com/subdir1/order/create > www.mywebsite.com/subdir2/order/create > > I''d like both urls to call the same action in the same controller. How can > I do this? I know this may be complicated, but I''m prepared to go a long > way. > > > Shimon > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
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 sub-directories. 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. map.connect "/subdir1/:controller/:action/:id" map.connect "/subdir2/:controller/:action/:id" Should get you started. You can get very tricky with routes. Try searching this list, along with the standard google, and doc search. Cheers On 7/12/06, Bruno Celeste <bruno.celeste@gmail.com> wrote:> In your controller: > > class SubDir::OrderController < ApplicationController > end > > In app/views you have to create subdir directory to put the views > concerning this controller. > > On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote: > > > > Hi, > > > > I''d like to create the following setup with RoR: > > > > www.mywebsite.com/subdir1/order/create > > www.mywebsite.com/subdir2/order/create > > > > I''d like both urls to call the same action in the same controller. How > can > > I do this? I know this may be complicated, but I''m prepared to go a long > > way. > > > > > > Shimon > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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 recommended: class subdir1::OrderController < ApplicationController def create end end This will give me the following url: www.mywebsite.com/subdir1/order/create But I wan''t two urls to call the same controller/action: www.mywebsite.com/subdir1/order/create www.mywebsite.com/subdir2/order/create How can I achieve this? Shimon On 7/12/06, Bruno Celeste <bruno.celeste@gmail.com> wrote:> > In your controller: > > class SubDir::OrderController < ApplicationController > end > > In app/views you have to create subdir directory to put the views > concerning this controller. > > On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote: > > > > Hi, > > > > I''d like to create the following setup with RoR: > > > > www.mywebsite.com/subdir1/order/create > > www.mywebsite.com/subdir2/order/create > > > > I''d like both urls to call the same action in the same controller. How > can > > I do this? I know this may be complicated, but I''m prepared to go a > long > > way. > > > > > > Shimon > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060712/b209230b/attachment.html
Sorry, I didn''t get that :) Daniel N is right, routes is what you''re looking for. On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote:> > 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 recommended: > > class subdir1::OrderController < ApplicationController > def create > end > end > > This will give me the following url: > > > www.mywebsite.com/subdir1/order/create > > > But I wan''t two urls to call the same controller/action: > > www.mywebsite.com/subdir1/order/create > www.mywebsite.com/subdir2/order/create > > How can I achieve this? > > > Shimon > > On 7/12/06, Bruno Celeste <bruno.celeste@gmail.com> wrote: > > In your controller: > > > > class SubDir::OrderController < ApplicationController > > end > > > > In app/views you have to create subdir directory to put the views > > concerning this controller. > > > > On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote: > > > > > > Hi, > > > > > > I''d like to create the following setup with RoR: > > > > > > www.mywebsite.com/subdir1/order/create > > > www.mywebsite.com/subdir2/order/create > > > > > > I''d like both urls to call the same action in the same controller. How > can > > > I do this? I know this may be complicated, but I''m prepared to go a > long > > > way. > > > > > > > > > Shimon > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Thanks, I will check that out! On 7/12/06, Bruno Celeste <bruno.celeste@gmail.com> wrote:> > Sorry, I didn''t get that :) > Daniel N is right, routes is what you''re looking for. > > On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote: > > > > 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 > recommended: > > > > class subdir1::OrderController < ApplicationController > > def create > > end > > end > > > > This will give me the following url: > > > > > > www.mywebsite.com/subdir1/order/create > > > > > > But I wan''t two urls to call the same controller/action: > > > > www.mywebsite.com/subdir1/order/create > > www.mywebsite.com/subdir2/order/create > > > > How can I achieve this? > > > > > > Shimon > > > > On 7/12/06, Bruno Celeste <bruno.celeste@gmail.com> wrote: > > > In your controller: > > > > > > class SubDir::OrderController < ApplicationController > > > end > > > > > > In app/views you have to create subdir directory to put the views > > > concerning this controller. > > > > > > On 7/12/06, Shimon Amit <shimon.amit@gmail.com> wrote: > > > > > > > > Hi, > > > > > > > > I''d like to create the following setup with RoR: > > > > > > > > www.mywebsite.com/subdir1/order/create > > > > www.mywebsite.com/subdir2/order/create > > > > > > > > I''d like both urls to call the same action in the same > controller. How > > can > > > > I do this? I know this may be complicated, but I''m prepared to go a > > long > > > > way. > > > > > > > > > > > > Shimon > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060712/d6b3ee1a/attachment.html