Many users try to overwrite the to_param method of AR to add more expressivness and value of Seo to the url using something like the following: def to_param id.to_s + title. parameterize + ''-'' + author. parameterize end That generate url like that: http://host/books/100000-goodbook-guest The id passed to AR is ''100-goodbook-guest'' that type_casted to integer in a trasparent way it will became 100. My proposal is to permit to read also url like the following http://host/books/goodbook-guest-100000 In other words, the id string passed to AR could have integer at the begining or end of itself -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Very limited use-case. Can''t see the point of it. -1 On Monday, 9 July 2012 at 3:58 PM, angelo capilleri wrote:> Many users try to overwrite the to_param method of AR to add more > expressivness and value of Seo to the url using something like the > following: > > def to_param > id.to_s + title. parameterize + ''-'' + author. parameterize > end > > That generate url like that: > > http://host/books/100000-goodbook-guest > > The id passed to AR is ''100-goodbook-guest'' that type_casted to > integer in a trasparent way it will became 100. > > My proposal is to permit to read also url like the following > > http://host/books/goodbook-guest-100000 > > In other words, the id string passed to AR could have integer at the > begining or end of itself > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Agreed, If you want custom slugs use something like https://github.com/norman/friendly_id and then you can just forego the id in the url all together. On Monday, July 9, 2012 at 1:18 AM, Ryan Bigg wrote:> Very limited use-case. Can''t see the point of it. > > -1 > > On Monday, 9 July 2012 at 3:58 PM, angelo capilleri wrote: > > > Many users try to overwrite the to_param method of AR to add more > > expressivness and value of Seo to the url using something like the > > following: > > > > def to_param > > id.to_s + title. parameterize + ''-'' + author. parameterize > > end > > > > That generate url like that: > > > > http://host/books/100000-goodbook-guest > > > > The id passed to AR is ''100-goodbook-guest'' that type_casted to > > integer in a trasparent way it will became 100. > > > > My proposal is to permit to read also url like the following > > > > http://host/books/goodbook-guest-100000 > > > > In other words, the id string passed to AR could have integer at the > > begining or end of itself > > > > > > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Moreover, in order to really optimize your SEO, you shouldn''t rely only on the ID, but you should also check the slug. Otherwise, it generates duplicate content as you can have hundreds of different urls with the same content. Damien MATHIEU | Ingénieur logiciel 84, rue Chevreul | 69 007 Lyon Tel. : +33 (0)6 88 42 00 15 | http://dmathieu.com On 9 July 2012 08:27, Richard Schneeman <richard.schneeman@gmail.com> wrote:> Agreed, If you want custom slugs use something like > https://github.com/norman/friendly_id and then you can just forego the id > in the url all together. > > On Monday, July 9, 2012 at 1:18 AM, Ryan Bigg wrote: > > Very limited use-case. Can''t see the point of it. > > -1 > > On Monday, 9 July 2012 at 3:58 PM, angelo capilleri wrote: > > Many users try to overwrite the to_param method of AR to add more > expressivness and value of Seo to the url using something like the > following: > > def to_param > id.to_s + title. parameterize + ''-'' + author. parameterize > end > > That generate url like that: > > http://host/books/100000-goodbook-guest > > The id passed to AR is ''100-goodbook-guest'' that type_casted to > integer in a trasparent way it will became 100. > > My proposal is to permit to read also url like the following > > http://host/books/goodbook-guest-100000 > > In other words, the id string passed to AR could have integer at the > begining or end of itself > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.