Simple support for using slug-generating fields in Formtastic
Go to file
John Bintz cf7715238a change the button types to make capybara finding easier 2013-04-22 09:42:47 -04:00
lib change the button types to make capybara finding easier 2013-04-22 09:42:47 -04:00
.gitignore 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
README.md be ok when there are no existing slugs 2013-02-21 16:43:20 -05:00
Rakefile initial commit 2012-12-14 17:40:17 -05:00
formtastic-slug.gemspec initial commit 2012-12-14 17:40:17 -05:00

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'