Simple gem for autogenerating permalink style slugs for your ActiveRecord models.
- Ruby 2.0.0+
- Rails 3.1 or higher.
Add this line to your application’s Gemfile:
And then execute:
Or install it yourself as:
$ gem install slugtastic
Usage is very simple. Just add the following to your model:
slug :slug, from: :title
This will generate a slug string from the title attribute and store it in the slug attribute unless the slug already contains a string. The slug is generated pre-validation so you can still use
There are no extra options at present.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request