Hi, I''m new to RoR, but currently need to make some changes to my site to implement permalinks. Whenever I do a link, I use: category_path(category) and then the to_param permalinks it. The previous piece of code would link you to / categories/CategoryPermalink; the trouble is I don''t want it to be / categories, I just want it to be /PERMALINK. Then I''m getting into even more trouble, as each category has_many tutorials, I have to do the same with this. At the moment tutorial_path(tutorial) makes it go to /tutorial/TutorialPermalink, however I want it to go to /CategoryPermalink/TutorialPermalink. Is there any way of doing this (at the moment I''m playing around with routes.rb, and then changing the action, and controller in the link; I don''t really know what I''m doing, but this seems to alter the URL sometimes). After I figure this out I have to then redirect all of the other URLs (/categories/id, /tutorials/id, /CategoryPermalink/tutorialid, / categories/id/tutorials/id and any other URLs that have the same type of ideas) to the right URLs (I don''t have a clue how to do this either, but I guess I''ll leave that for another thread). Please Help, Thanks In Advance, Joe -- 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.
Bump?! Please Help, Thanks In Advance, Joe On Jul 26, 7:29 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Hi, > > I''m new to RoR, but currently need to make some changes to my site to > implement permalinks. > Whenever I do a link, I use: category_path(category) and then the > to_param permalinks it. The previous piece of code would link you to / > categories/CategoryPermalink; the trouble is I don''t want it to be / > categories, I just want it to be /PERMALINK. > Then I''m getting into even more trouble, as each category has_many > tutorials, I have to do the same with this. At the moment > tutorial_path(tutorial) makes it go to /tutorial/TutorialPermalink, > however I want it to go to /CategoryPermalink/TutorialPermalink. > > Is there any way of doing this (at the moment I''m playing around with > routes.rb, and then changing the action, and controller in the link; I > don''t really know what I''m doing, but this seems to alter the URL > sometimes). > > After I figure this out I have to then redirect all of the other URLs > (/categories/id, /tutorials/id, /CategoryPermalink/tutorialid, / > categories/id/tutorials/id and any other URLs that have the same type > of ideas) to the right URLs (I don''t have a clue how to do this > either, but I guess I''ll leave that for another thread). > > Please Help, > > Thanks In Advance, > > Joe-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Can anyone help with this? I really need help, Please Help, Thanks In Advance, Joe -- 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.
Ok, I think I''ve made a tiny bit of progress. I''ve got the URLs I want to work using routes.rb I now just need to application to link to the right place, Im trying to get it to go to "CATID/ID" but it links to "categories/ID? cat_id=CATID". I''m giving it all of the correct parameters that my routes require, however it for some reason want to link to it as shown above. Please Help, Thanks In Advance, Joe On Jul 27, 7:54 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Can anyone help with this? > > I really need help, > > Please Help, > > Thanks In Advance, > > Joe-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
youtube-T/oTI28FLjDQXOPxS62xeg@public.gmane.org
2010-Jul-27 20:50 UTC
Re: Changing the model_path.
Aha, I think I''ve finally figured it out with named routes! However my named route only works when its on the top line, and I need to make a static map.connect above it or the web app wont work; why does it make me put it at the top (there is nothing overwriting it or anything below). When it''s not at the top it says this: undefined method `catpmlnk'' (which is the named route name).. Please help (I''m so close to solving my problems!), Thanks In Advance, Joe On Jul 27, 5:33 pm, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Ok, I think I''ve made a tiny bit of progress. I''ve got the URLs I want > to work using routes.rb > > I now just need to application to link to the right place, Im trying > to get it to go to "CATID/ID" but it links to "categories/ID? > cat_id=CATID". > > I''m giving it all of the correct parameters that my routes require, > however it for some reason want to link to it as shown above. > > Please Help, > > Thanks In Advance, > > Joe > > On Jul 27, 7:54 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Can anyone help with this? > > > I really need help, > > > Please Help, > > > Thanks In Advance, > > > Joe > >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.