Hi, Urls in ruby are as defualt set to :controller/:action/:id How can I change it to somthing like this :controller/:action/:id/#random title# #random title# may be a variable or taken from a field in the database thanks scott -- Posted via http://www.ruby-forum.com/.
Matt Griffith
2006-Jul-13 14:46 UTC
[Rails] Re: creating meaningful urls, (changing default)
scot wrote:> How can I change it to somthing like this > :controller/:action/:id/#random title#The default answer would be don''t. Resist the urge. Your primary keys aren''t combined keys, your Urls don''t need to be either. But I know there are many reasons for wanting this. Here''s one take: http://blog.hasmanythrough.com/articles/2006/07/07/more-on-naming-and-the-crud If you can live with :controller/:action/:id-#random title# instead that might be the easiest way to go. I''m pretty sure there is an easy way to get exactly what you''re after too, but I''ll let someone who understands routes better chime in with the details. Matt Griffith http://mattgriffith.net -- Posted via http://www.ruby-forum.com/.
Eric Anderson
2006-Jul-13 14:57 UTC
[Rails] Re: creating meaningful urls, (changing default)
scot wrote:> How can I change it to somthing like this > :controller/:action/:id/#random title#http://plasmasturm.org/log/358/ Eric
Matt Griffith wrote:> scot wrote: > >> How can I change it to somthing like this >> :controller/:action/:id/#random title# > > The default answer would be don''t. Resist the urge. Your primary keys > aren''t combined keys, your Urls don''t need to be either.SEO is the main reason for wanting to change the defult url layout, thanks for the link. Given me a couple more ideas for url layouts. -- Posted via http://www.ruby-forum.com/.
Eric Anderson wrote:> scot wrote: >> How can I change it to somthing like this >> :controller/:action/:id/#random title# > > http://plasmasturm.org/log/358/ > > Ericnice link, exactly what I need to do, any suggestions on how to go about doing this? -- Posted via http://www.ruby-forum.com/.
Eric Anderson
2006-Jul-14 16:21 UTC
[Rails] Re: creating meaningful urls, (changing default)
scot wrote:> nice link, exactly what I need to do, any suggestions on how to go about > doing this?http://www.notsostupid.com/blog/2006/07/07/urls-on-rails/ Eric
i m also looking for the same.... scot wrote:> Hi, > > Urls in ruby are as defualt set to :controller/:action/:id > > How can I change it to somthing like this > :controller/:action/:id/#random title# > > #random title# may be a variable or taken from a field in the database > > thanks > scott-- 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 -~----------~----~----~----~------~----~------~--~---