A simple slug generator for Rails.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib Version number update to 1.3.0 Mar 25, 2016
spec Significant refactor and cleanup Mar 25, 2016
.gitignore
.rspec
.rubocop.yml Significant refactor and cleanup Mar 25, 2016
.travis.yml
CHANGELOG.md
Gemfile Gem rewrite with spec. There's one test left to get passing. Aug 17, 2012
Gemfile.lock Update rspec and rake Mar 26, 2016
LICENSE
README.md
Rakefile Significant refactor and cleanup Mar 25, 2016
slugtastic.gemspec Update rspec and rake Mar 26, 2016

README.md

Slugtastic

Codeship Status for danbee/slugtastic

Gem Version

Simple gem for autogenerating permalink style slugs for your ActiveRecord models.

Requirements

  • Ruby 2.0.0+
  • Rails 3.1 or higher.

Installation

Add this line to your application's Gemfile:

gem 'slugtastic'

And then execute:

$ bundle

Or install it yourself as:

$ gem install slugtastic

Usage

Usage is very simple. Just add the following to your model:

slug :slug, from: :title

This will generate a slug string from the title attribute and store it in the slug attribute unless the slug already contains a string. The slug is generated pre-validation so you can still use validates_presence_of :slug.

There are no extra options at present.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request