On Friday, January 25, 2019 at 9:06:22 AM UTC-5, Walter Lee Davis wrote:
>
>
> > On Jan 25, 2019, at 6:00 AM, fugee ohu <[email protected] <javascript:>> 
> wrote: 
> > 
> > I wanna convert my news stories to use slug urls based on the :headline 
> column instead of id's but some of the rows contain special characters like 
> double quotes, exclamation points, do I need to gsub those out 
>
> An interesting theory, but FriendlyId already does this, quite 
> elaborately. The logic that does the "dumbification" is delegated to 
> ActiveSupport's parameterize method, which takes everything not-ASCII and 
> transliterates it into ASCII, and replaces any run of whitespace with a 
> single dash, and removes punctuation. Next, the slug is checked for 
> duplicates with any existing record, and a UUID is appended if so. It's 
> really quite well done and very settled code. I have been using FriendlyId 
> for 8 years or more without encountering any error that wasn't my own 
> mistake. 
>
> In another of your many threads, you mention that you are trying to create 
> a slug out of the article's text, rather than the headline (as the 
> documentation encourages). You may want to try starting from a truncated 
> copy of the article text (or even following the directions) before you 
> assume that FriendlyId is at fault here. I doubt that your article text 
> will fit into the size constraints of a URL segment, particularly if you 
> worry about IE users seeing the thing at all*' 
>
> Walter 
>
> *The entire URL, including prefix, host, port, and path, must be no more 
> than 1,024 characters ASCII in order to be visited by IE. 
>
>
So I have to change the length of the varchar field and the length of the 
index as well? 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0d80957a-d522-4f30-9aeb-a355ea132b0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to