mirror of
https://github.com/danbee/danbarber.me.hugo.git
synced 2025-03-04 08:59:18 +00:00
738 B
738 B
| title | date | categories | layout | comments | |||||
|---|---|---|---|---|---|---|---|---|---|
| Slugtastic v1.0.0 | Tue, 21 Aug 2012 10:09:00 +0000 |
|
post | true |
I've just released my first proper Ruby gem. It's a simple permalink style slug generator for ActiveModel. Check it out at Github and use it in your Rails project by adding gem "slugtastic" to your Gemfile.
Usage is very simple. Just add the following to your model:
has_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 validates_presence_of :slug.