Simple support for using slug-generating fields in Formtastic
Go to file
John Bintz 20e3f4ad51 oops
2013-04-03 07:29:15 -04:00
lib oops 2013-04-03 07:29:15 -04:00
.gitignore initial commit 2012-12-14 17:40:17 -05:00
formtastic-slug.gemspec initial commit 2012-12-14 17:40:17 -05:00
Gemfile initial commit 2012-12-14 17:40:17 -05:00
LICENSE.txt initial commit 2012-12-14 17:40:17 -05:00
Rakefile initial commit 2012-12-14 17:40:17 -05:00
README.md be ok when there are no existing slugs 2013-02-21 16:43:20 -05:00

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'