Rails has a built-in slug generator

Posted About 9 years ago. Visible to the public.

Today I learned that Ruby on Rails has shipped with a built-in slug generator Show archive.org snapshot since Rails 2.2:

> "What Up Dog".parameterize
=> "what-up-dog" 

> "foo/bar".parameterize
=> "foo-bar" 

> "äöüß".parameterize
=> "aouss" 

Also see: Normalize characters in Ruby.

Henning Koch
Last edit
About 9 years ago
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2015-04-08 07:01)