Skip to content

ludo/to_slug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToSlug

This plugin adds a to_slug method to String instances. With this method you can easily generate a slug from any string. Slugs can be used for URLs, since all 'dangerous' characters have been filtered out.

Examples

"Hello World".to_slug
# => "hello-world"

"The World is Beautiful!".to_slug 
# => "the-world-is-beautiful"

It handles unicode characters too:

"aëòúi".to_slug 
# => "aeoui"

And underscores are left intact:

"Please leave my_underscores_intact".to_slug
# => "please-leave-my_underscores_intact"

See the specs for more (complex) examples.

Installation

Using Rails plugin installer script:

script/plugin install git://github.com/ludo/to_slug.git

Or as a submodule in a Git repository:

git submodule add git://github.com/ludo/to_slug.git vendor/plugins/to_slug

Copyright (c) 2008 Cubicphuse, released under the MIT license

About

Rails plugin that adds a to_slug method to String instances. Slugs can be used for URLs, since all 'dangerous' characters have been filtered out.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages