Can anyone please explain to me how to get ugly urls like : hostname.com/browse/day?cal_name=name&day=9&month=6&year=2008 to be something nice like: hostname.com/browse/name/day/month/year or something like that? I''ve read a bit about routes but I don''t see any examples anywhere really of how to do this. -- 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 -~----------~----~----~----~------~----~------~--~---
On Jun 5, 2008, at 2:42 PM, Amanda .. wrote:> Can anyone please explain to me how to get ugly urls like : > > hostname.com/browse/day?cal_name=name&day=9&month=6&year=2008 > > to be something nice like: > > hostname.com/browse/name/day/month/year > > or something like that? > > I''ve read a bit about routes but I don''t see any examples anywhere > really of how to do this.map.connect ''browse/:cal_name/:day/:month/:year'', :controller => ''browse'', :action => ''day'' Assuming that the default route was picking up your example URL. -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> map.connect ''browse/:cal_name/:day/:month/:year'', :controller => > ''browse'', :action => ''day'' > > Assuming that the default route was picking up your example URL. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.orgwhere do I do that? -- 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 -~----------~----~----~----~------~----~------~--~---
and also, since the :day, :cal_name etc are parameters would I have to do ''browse/params[:cal_name]/params[:day]/...''? -- 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 -~----------~----~----~----~------~----~------~--~---
On Jun 5, 2008, at 3:00 PM, Amanda .. wrote:> >> map.connect ''browse/:cal_name/:day/:month/:year'', :controller => >> ''browse'', :action => ''day'' >> >> Assuming that the default route was picking up your example URL. >> >> -Rob >> >> Rob Biedenharn http://agileconsultingllc.com >> Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > > where do I do that?In your project''s config/routes.rb file, of course. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
oh lol thanks so much! -- 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 -~----------~----~----~----~------~----~------~--~---
Amanda, You may want to read into how you can setup customer routes using the routes.rb files in rails... Furthermore you may want to read into RESTful development, and how rails deals with Resources etc... might help with your issue here. There''s a TON of information on this on the net, and there''s just too much to go through here... On Jun 5, 3:32 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> On Jun 5, 2008, at 3:00 PM, Amanda .. wrote: > > > > >> map.connect ''browse/:cal_name/:day/:month/:year'', :controller => > >> ''browse'', :action => ''day'' > > >> Assuming that the default route was picking up your example URL. > > >> -Rob > > >> Rob Biedenharn http://agileconsultingllc.com > >> R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > > > where do I do that? > > In your project''s config/routes.rb file, of course.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Or, I find The Rails Way by Obie Fernandez exceptionally clear on this topic. Excellent book in many ways, but it seems to really shine on routings. Ron On Jun 5, 3:42 pm, sw0rdfish <san...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Amanda, > > You may want to read into how you can setup customer routes using the > routes.rb files in rails... Furthermore you may want to read into > RESTful development, and how rails deals with Resources etc... might > help with your issue here. > > There''s a TON of information on this on the net, and there''s just too > much to go through here... > > On Jun 5, 3:32 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote: > > > On Jun 5, 2008, at 3:00 PM, Amanda .. wrote: > > > >> map.connect ''browse/:cal_name/:day/:month/:year'', :controller => > > >> ''browse'', :action => ''day'' > > > >> Assuming that the default route was picking up your example URL. > > > >> -Rob > > > >> Rob Biedenharn http://agileconsultingllc.com > > >> R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > > > > where do I do that? > > > In your project''s config/routes.rb file, of course.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---