Hello, How can I use polymorphic_url to generate the index action? It works fine with the create action so far. Thanks! -- 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 -~----------~----~----~----~------~----~------~--~---
Perhaps I should be more specific: I''m using STI (single table inheritance) and I''m displaying the objects using the same view. I need to put a link to the index. polymorphic_url helped me so far, because it generates the new, create, update and edit URLs depending on the object type, but there seems to be no easy way to generate the index URL. Gabi Ge wrote:> Hello, > > How can I use polymorphic_url to generate the index action? It works > fine with the create action so far. > > Thanks!-- 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 -~----------~----~----~----~------~----~------~--~---
Try: polymorphic_url([@parent, ChildClass.new]) If the array contains an item which is new (not saved), then it uses the plural form of path (index). On Nov 14, 8:36 am, Gabi Ge <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Perhaps I should be more specific: > > I''m using STI (single table inheritance) and I''m displaying the objects > using the same view. I need to put a link to the index. polymorphic_url > helped me so far, because it generates the new, create, update and edit > URLs depending on the object type, but there seems to be no easy way to > generate the index URL. > > Gabi Ge wrote: > > Hello, > > > How can I use polymorphic_url to generate the index action? It works > > fine with the create action so far. > > > Thanks! > > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---