hi, just added this to my routes: map.namespace :admin do |admin| admin.resources :categories end to have a /admin/.... urls. but now all of my other links do have that prefix!? why is that? any ideas? thx -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You just added categories to your admin resource. That said, you''ll end up with routes looking like this /admin/id/resource. What that means is that any time you need to call a resource, you''ll have to include the admin id in it as they as "nested". You could have a look at this railscast http://railscasts.com/episodes/139-nested-resources Luis http://www.saffie.ca -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thx luis, i know what u are describing. what i didnt know and dont know how to "undo" is: being on a regular resource, eg index-view of projects, all urls show fine, eg :3000/tasks, 3000/milestones, .... but being on the admin/categories resource and i hover over the "link_to projects" and all the others, it shows me /admin/projects. i didnt specify that, so im just wondering .... thx On Thu, Oct 21, 2010 at 1:06 PM, Luis Saffie <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> You just added categories to your admin resource. That said, you''ll end > up with routes looking like this /admin/id/resource. > > What that means is that any time you need to call a resource, you''ll > have to include the admin id in it as they as "nested". > > You could have a look at this railscast > http://railscasts.com/episodes/139-nested-resources > > > Luis > > http://www.saffie.ca > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Can you post your link_to code? If you have something like link_to projects_path it shouldn''t pick the the route from admin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thats exaclty why im gettin confused. here are two link from the application.rhtml: <%= link_to "Invite Friends", :controller=>''tellyourfriends'', :action=>''new'' if logged_in? %> <%= link_to_unless_current ''Browse Categories'', :controller=>''categories'', :action=>''index'' here the routes: map.namespace :admin do |admin| admin.resources :categories end map.resources :categories is there somethign wrong here? thx for ur time! i appreciate it tom On Thu, Oct 21, 2010 at 1:29 PM, Luis Saffie <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Can you post your link_to code? > > If you have something like > link_to projects_path > > it shouldn''t pick the the route from admin > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You''re defining categories as a single resource and nested resource. That''s why you''re getting the conflicting results. Which one of the two links are is displaying the nested url? I assume the second one Luis -- http://www.saffie.ca -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
well, i was following a tutorial regarding admin namespaces. i do have a model holding categories. goeal would be to have a user-ui to have just 3000/categories and an admin-ui for editing etc. not sure now how to proceed. i would like to keep the admin views in a separate folder plus admin-controller. do u have a pointer? thx On Thu, Oct 21, 2010 at 2:01 PM, Luis Saffie <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> You''re defining categories as a single resource and nested resource. > That''s why you''re getting the conflicting results. > > Which one of the two links are is displaying the nested url? I assume > the second one > > > Luis > -- > > http://www.saffie.ca > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
im not sure if you need a nested resource for what you want to accomplish. Just go ahead and define admin and categories as a single resource. Luis -- http://www.saffie.ca -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Looking at the documentation more closely, you could do something like this in your routes namespace "admin" do resources :categories end This will give you /admin/categories in the way you want. http://guides.rubyonrails.org/routing.html Luis -- http://www.saffie.ca -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yes, was looking at the same, but that is rails3 if im not wrong. ill keep digging thx On Thu, Oct 21, 2010 at 2:21 PM, Luis Saffie <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Looking at the documentation more closely, you could do something like > this in your routes > > namespace "admin" do > resources :categories > end > > This will give you /admin/categories in the way you want. > > http://guides.rubyonrails.org/routing.html > > > Luis > -- > > http://www.saffie.ca > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
doing just: map.namespace :admin do |admin| admin.resources :categories, :controller=>"categories" end gives me two routes: /admin/categories /categories both are hitting the right controllers, but once im on the admin-index-view, all other links are still prefixed with admin. o well On Thu, Oct 21, 2010 at 2:37 PM, tom <tomabroad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > yes, was looking at the same, but that is rails3 if im not wrong. > > ill keep digging > > thx > > > On Thu, Oct 21, 2010 at 2:21 PM, Luis Saffie <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> Looking at the documentation more closely, you could do something like >> this in your routes >> >> namespace "admin" do >> resources :categories >> end >> >> This will give you /admin/categories in the way you want. >> >> http://guides.rubyonrails.org/routing.html >> >> >> Luis >> -- >> >> http://www.saffie.ca >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
type rake routes to figure out all the new routes -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Tom wrote in post #956151:> doing just: > map.namespace :admin do |admin| > > admin.resources :categories, :controller=>"categories" > end > > gives me two routes: > /admin/categories > /categories > > both are hitting the right controllers, but once im on the > admin-index-view, > all other links are still prefixed with admin. o wellYou may need to use :controller => ''/whatever'' instead of :controller => ''whatever'' in your link_to to force things into the root namespace. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I find it weird that it''s doing that. If you use the correct restful path, it should hit the right url But you can try what Marnen suggested, seem hacky though.. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Luis Saffie wrote in post #956383:> I find it weird that it''s doing that. If you use the correct restful > path, it should hit the right urlOh, yeah, named routes shouldn''t be affected.> > But you can try what Marnen suggested, seem hacky though..I wouldn''t call it hacky. Rails link_to, presumably by design, assumes the current namespace unless otherwise specified. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, Oct 22, 2010 at 3:14 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Luis Saffie wrote in post #956383: > > I find it weird that it''s doing that. If you use the correct restful > > path, it should hit the right url > > Oh, yeah, named routes shouldn''t be affected. > > > > > But you can try what Marnen suggested, seem hacky though.. > > I wouldn''t call it hacky. Rails link_to, presumably by design, assumes > the current namespace unless otherwise specified. > >i ddint know that. good to know. is there a way of setting this dynamically? thx tom Best,> -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.