formtastic-slug/README.md

22 lines
564 B
Markdown
Raw Normal View History

2012-12-14 22:40:17 +00:00
Add a slug field, that generates a slug based on another field.
``` haml
= semantic_form_for @blog_entry do |f|
= f.input :title
= f.input :slug, :as => :slug, :based_on => :title
```
2013-02-21 21:43:20 +00:00
You can put in the list of existing slugs and the editor will avoid using those:
``` haml
= semantic_form_for @blog_entry do |f|
= f.input :title
= f.input :slug, :as => :slug, :based_on => :title, :existing_slugs => @blog_entry.class.slugs
```
2012-12-14 22:40:17 +00:00
Just add it to your Gemfile:
``` ruby
gem 'formtastic-slug', :git => 'git://github.com/johnbintz/formtastic-slug.git'
```