I''m moved some controllers to app/admin/ and add this to the routes map.connect ''admin/:controller/:action/:id'' The controllers have the admin prefix : class Admin::DoSomethingController < ApplicationController ... After the first time accessing the url the ''admin'' dir is added again. The result url looks like this: http://.../admin/admin/do_something/edit/1 How can this be fixed?? Ideas , anyone? Rails 1.2.2 Gems 0.9.2 -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I''m moved some controllers to > app/admin/ > > and add this to the routes > > map.connect ''admin/:controller/:action/:id'' > > The controllers have the admin prefix : > > class Admin::DoSomethingController < ApplicationController > ... > > After the first time accessing the url the ''admin'' dir is added again. The > result url looks like this: > > http://.../admin/admin/do_something/edit/1 > > How can this be fixed?? Ideas , anyone?Why not just remove that route? I do the same thing as you but don''t have that route... just a single route to map "/admin" to the default controller in my admin area. -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom wrote:>> ... >> >> After the first time accessing the url the ''admin'' dir is added again. The >> result url looks like this: >> >> http://.../admin/admin/do_something/edit/1 >> >> How can this be fixed?? Ideas , anyone? > > Why not just remove that route? I do the same thing as you but don''t > have > that route... just a single route to map "/admin" to the default > controller in my admin area. > > -philipThis is correct. When you move controller into a subfolder like that, the new "url name" of that controller is "admin/do_stuff". With the route "admin/:controller", the url name of the controller "admin/do_stuff" gets inserted into :controller, producing "admin/admin/do_stuff". So get rid of that admin route and lets ActionController do its thang. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, -Larry On 2/9/07, Alex Wayne <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Philip Hallstrom wrote: > >> ... > >> > >> After the first time accessing the url the ''admin'' dir is added again. > The > >> result url looks like this: > >> > >> http://.../admin/admin/do_something/edit/1 > >> > >> How can this be fixed?? Ideas , anyone? > > > > Why not just remove that route? I do the same thing as you but don''t > > have > > that route... just a single route to map "/admin" to the default > > controller in my admin area. > > > > -philip > > This is correct. > > When you move controller into a subfolder like that, the new "url name" > of that controller is "admin/do_stuff". With the route > "admin/:controller", the url name of the controller "admin/do_stuff" > gets inserted into :controller, producing "admin/admin/do_stuff". > > So get rid of that admin route and lets ActionController do its thang. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom said the following on 02/09/2007 06:02 PM:>> I''m moved some controllers to >> app/admin/ >> >> and add this to the routes >> >> map.connect ''admin/:controller/:action/:id'' >> >> The controllers have the admin prefix : >> >> class Admin::DoSomethingController < ApplicationController >> ... >> >> After the first time accessing the url the ''admin'' dir is added again. The >> result url looks like this: >> >> http://.../admin/admin/do_something/edit/1 >> >> How can this be fixed?? Ideas , anyone? > > Why not just remove that route? I do the same thing as you but don''t have > that route... just a single route to map "/admin" to the default > controller in my admin area.I''m having a similar-but-different problem. I''m working on a wiki with webs (books in i2 parlance), so the normal url reads http://sitename.com/Web/WikiWordTopic (do I use ":requirements" to make sure?) so the admin interface for doing things that the normal wiki user can''t is http://sitename.com/admin/web for the list http://sitename.com/admin/web/Web for a specific web http://sitename.com/admin/web/Web/WikiWordTopic for a specific topic and drill down for its attributes. Yes, I still have things to sort out like what the urls are for the user to login and return to the access controlled topic (or is that done via cookies), edit a topic ... and of course what all that looks like in the mappings... 1. Philip could you post the line from your routes.rb, please, to clarify. 2. If you move the controllers to app/controllers/admin do you have to add the Admin:: prefix? Or, to ask it all another way, is there a different way to compartmentalise both the code and the URL? (such as .../do_something/1?admin perhaps) -- If the box says ``Windows 95 or better'''', it should run on Linux, right? (Seen on Usenet) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
one quick and dirty way to fix controller problems like these is to include the "/" in the beginning of your RAILS methods. IE: normally you may have link_to :controller => "admin/main", :action => "do_something", :id => object.id This would be changed to link_to :controller => "/admin/main", :action => "do_something", :id => object.id and that forces the routing to start at the root. hope that helps --jake Anton Aylward wrote:> Philip Hallstrom said the following on 02/09/2007 06:02 PM: >>> ... >> controller in my admin area. > I''m having a similar-but-different problem. > > I''m working on a wiki with webs (books in i2 parlance), so the normal > url reads > http://sitename.com/Web/WikiWordTopic > > (do I use ":requirements" to make sure?) > > so the admin interface for doing things that the normal wiki user can''t > is > > http://sitename.com/admin/web for the list > http://sitename.com/admin/web/Web for a specific web > http://sitename.com/admin/web/Web/WikiWordTopic for a specific topic > > and drill down for its attributes. > > Yes, I still have things to sort out like what the urls are for > the user to login and return to the access controlled topic (or is that > done > via cookies), edit a topic ... and of course what all that looks like in > the > mappings... > > > > 1. Philip could you post the line from your routes.rb, please, to > clarify. > > 2. If you move the controllers to app/controllers/admin do you have to > add > the > Admin:: prefix? > > Or, to ask it all another way, is there a different way to > compartmentalise > both the code and the URL? > (such as .../do_something/1?admin perhaps) > > -- > If the box says ``Windows 95 or better'''', it should run on Linux, right? > (Seen on Usenet)-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---