Hey guys You know how by default the scaffold show view takes you to for ex- www.blah.com/blahs/16? How would i replace that 16 with something else?... most preferably the title field or something What do i need to change in the routes? Thanks -- 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.
On Sun, Apr 4, 2010 at 4:08 PM, David Zhu <dzwestwindsor45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey guys > > You know how by default the scaffold show view takes you to for ex- > www.blah.com/blahs/16? > > How would i replace that 16 with something else?... most preferably > the title field or something > >David, please take a look at the to_param method which you can redefine to display something other than the id field. Good luck, -Conrad> What do i need to change in the routes? Thanks > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
On Sun, Apr 4, 2010 at 4:27 PM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, Apr 4, 2010 at 4:08 PM, David Zhu <dzwestwindsor45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> Hey guys >> >> You know how by default the scaffold show view takes you to for ex- >> www.blah.com/blahs/16? >> >> How would i replace that 16 with something else?... most preferably >> the title field or something >> >> > David, please take a look at the to_param method which you can redefine to > display something other than the id field. > > Good luck, > > -Conrad > > >> What do i need to change in the routes? Thanks >> >>David, here''s an excellent blog post by Obie Fernandez which goes into further detail about using to to_param method: http://www.jroller.com/obie/entry/seo_optimization_of_urls_in Good luck, -Conrad> -- >> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >-- 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.