I have the following routing layout: map.resources :users do |user| user.resources :blog, :controller => :user_blog_controller, :name_prefix => ''user_'' end The trouble is that I cannot user blog_path() without an argument. blogs_path() does not work either and it would be ugly/inconsistent if it did anyway. Couldn''t blog_path with no arguments just return /blog and not try to return /blog/SOME_ID? I could just do user.resources :blog_entries, but it doesn''t give as nice URLs. Besides, I have the same problem with user.resources :mailbox. Erik --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 7/24/07, Erik Allik <eallik@gmail.com> wrote:> > > The trouble is that I cannot user blog_path() without an argument. > blogs_path() does not work either and it would be ugly/inconsistent if > it did anyway.Maybe you wanted "user.resource" (singular) instead of "user.resources"? Read the API documentation to know the difference. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
My user blog contains the user's blog entries, so IT IS plural in semantics. It's just that I don't want the URL to be /user/123/blog_entries but /user/123/blog instead. Unfortunately, "blog" is singular. Erik P.S. Thanks for recommending to read the documentation. I've found the documentation as such to be a very useful thing indeed. :) On 24/07/07, Mislav Marohnić <mislav.marohnic@gmail.com> wrote:> On 7/24/07, Erik Allik <eallik@gmail.com> wrote: > > > > The trouble is that I cannot user blog_path() without an argument. > > blogs_path() does not work either and it would be ugly/inconsistent if > > it did anyway. > > Maybe you wanted "user.resource" (singular) instead of "user.resources"? > Read the API documentation to know the difference. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
It looks like your going have to map everything the old fashion way. You can''t use a singular word with a resource like that because map.resources wants to define singular and plural named routes like blog_path(id) == /blogs/id and blogs_path == /blogs. On Jul 24, 2:27 pm, "Erik Allik" <eal...@gmail.com> wrote:> My user blog contains the user''s blog entries, so IT IS plural in > semantics. It''s just that I don''t want the URL to be > /user/123/blog_entries but /user/123/blog instead. Unfortunately, > "blog" is singular. > > Erik > > P.S. Thanks for recommending to read the documentation. I''ve found the > documentation as such to be a very useful thing indeed. :) > > On 24/07/07, Mislav Marohnić <mislav.maroh...@gmail.com> wrote: > > > On 7/24/07, Erik Allik <eal...@gmail.com> wrote: > > > > The trouble is that I cannot user blog_path() without an argument. > > > blogs_path() does not work either and it would be ugly/inconsistent if > > > it did anyway. > > > Maybe you wanted "user.resource" (singular) instead of "user.resources"? > > Read the API documentation to know the difference.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Erik, See http://pastie.caboo.se/81889 Does it suit your needs? It''s semantic, it''s nice ... and it works. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 7/25/07, Erik Allik <eallik@gmail.com> wrote:> > Wow, thanks, dude!No problem. But next time pay more attention to the documentation: however obscure this parameter may be, it''s still documented. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---