Simple support for using slug-generating fields in Formtastic
lib | ||
.gitignore | ||
formtastic-slug.gemspec | ||
Gemfile | ||
LICENSE.txt | ||
Rakefile | ||
README.md |
Add a slug field, that generates a slug based on another field.
= semantic_form_for @blog_entry do |f|
= f.input :title
= f.input :slug, :as => :slug, :based_on => :title
You can put in the list of existing slugs and the editor will avoid using those:
= semantic_form_for @blog_entry do |f|
= f.input :title
= f.input :slug, :as => :slug, :based_on => :title, :existing_slugs => @blog_entry.class.slugs
Just add it to your Gemfile:
gem 'formtastic-slug', :git => 'git://github.com/johnbintz/formtastic-slug.git'