The path I currently have for a record in the post table is this: www.myrailsapp.com/post/id here''s the route: map.resources :posts, :has_many => :comments Any thoughts on how you would make the above this? www.myrailsapp.com/1djs34 (or some join of randomly generated letters and numbers) so that users easily bookmark the page and access it later. I''d want to replace the traditional path id with something more random. How would I make an extra column in the post table to do this? Did some google searching, but I guess I''m not hitting the right keywords. 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-/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 28 August 2010 05:07, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> The path I currently have for a record in the post table is this: > > www.myrailsapp.com/post/id > > here''s the route: > > map.resources :posts, :has_many => :comments > > Any thoughts on how you would make the above this? > > www.myrailsapp.com/1djs34 (or some join of randomly generated letters > and numbers) so that users easily bookmark the page and access it later.Why cannot they bookmark page www.myrailsapp.com/post/631 just as easily as www.../1djs32? Colin> > I''d want to replace the traditional path id with something more random. > How would I make an extra column in the post table to do this? >-- 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.
I suppose they could, but I''d like to make the URL path as short as possible. Plus, it''s a excuse to learn how it works :). Colin Law wrote:> On 28 August 2010 05:07, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> www.myrailsapp.com/1djs34 (or some join of randomly generated letters >> and numbers) so that users easily bookmark the page and access it later. > > Why cannot they bookmark page www.myrailsapp.com/post/631 just as > easily as www.../1djs32? > > Colin-- 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-/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 Sat, Aug 28, 2010 at 5:14 AM, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I suppose they could, but I''d like to make the URL path as short as > possible.Why? What possible value does an obfuscated and shortened URL offer anyone? If anything, most users would get more value out of something like www.myrailsapp.com/post/631-what-were-they-thinking which at least gives the user (as well as search engines!) *some* meta-information about the content of the resource...> Plus, it''s a excuse to learn how it works :)...and you could google `rails friendly urls` for implementation examples to study :-) FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.
That is true... I guess what I''m trying to get at is avoid using the built in ids as the resource identifier... and instead just using a randomly generated number as the identifier: www.myrailsapp.com/post/what-were-they-thinking-184952 Hassan Schroeder wrote:> On Sat, Aug 28, 2010 at 5:14 AM, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I suppose they could, but I''d like to make the URL path as short as >> possible. > > Why? What possible value does an obfuscated and shortened URL > offer anyone? > > If anything, most users would get more value out of something like > > www.myrailsapp.com/post/631-what-were-they-thinking > > which at least gives the user (as well as search engines!) *some* > meta-information about the content of the resource... > >> Plus, it''s a excuse to learn how it works :). > > ..and you could google `rails friendly urls` for implementation examples > to study :-) > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-/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 Sat, Aug 28, 2010 at 7:30 AM, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> That is true... I guess what I''m trying to get at is avoid using the > built in ids as the resource identifier... and instead just using a > randomly generated number as the identifier:Again, I don''t know why you''d bother :-) but you could generate a separate number on creation and use that -- google ''rails UUID'' for one approach. HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.
Awesome, thanks Hassan for pointing me in the right direction. Hassan Schroeder wrote:> On Sat, Aug 28, 2010 at 7:30 AM, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> That is true... I guess what I''m trying to get at is avoid using the >> built in ids as the resource identifier... and instead just using a >> randomly generated number as the identifier: > > Again, I don''t know why you''d bother :-) but you could generate a > separate number on creation and use that -- google ''rails UUID'' for > one approach. > > HTH, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-/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.
Hassan Schroeder wrote:> On Sat, Aug 28, 2010 at 5:14 AM, Ze Ca <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I suppose they could, but I''d like to make the URL path as short as >> possible. > > Why? What possible value does an obfuscated and shortened URL > offer anyone? >It''s more Twitter-friendly. See http://groups.google.com/group/techvalleyrb/msg/ac3ce4ae6620268a?pli=1 for one possibility. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/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 Sat, Aug 28, 2010 at 9:21 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:>> Why? What possible value does an obfuscated and shortened URL >> offer anyone? > > It''s more Twitter-friendly.Point taken. But I''d still rather see a human/SEO-friendly URL in my browser and as appropriate provide a "tweetable" version on the page :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.