Simple support for using slug-generating fields in Formtastic
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
John Bintz 78020920d5
Merge branch 'master' of github.com:johnbintz/formtastic-slug
11 years ago
lib Merge branch 'master' of github.com:johnbintz/formtastic-slug 11 years ago
.gitignore initial commit 11 years ago
Gemfile initial commit 11 years ago
LICENSE.txt initial commit 11 years ago
README.md be ok when there are no existing slugs 11 years ago
Rakefile initial commit 11 years ago
formtastic-slug.gemspec initial commit 11 years ago

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'