1
0
mirror of https://github.com/danbee/slugtastic synced 2025-03-04 08:49:05 +00:00
Go to file
2018-04-19 13:04:46 -04:00
lib Update version and changelog 2018-04-19 13:04:46 -04:00
spec Refactor fake model 2018-04-18 15:39:00 -04:00
.gitignore Fixed final test. Added .gitignore file. 2012-08-18 08:44:01 +01:00
.rspec Added .rspec file. 2012-08-17 19:35:28 +01:00
.rubocop.yml Update rubocop and remove redundant travis config 2018-04-18 15:19:05 -04:00
CHANGELOG.md Update version and changelog 2018-04-19 13:04:46 -04:00
Gemfile Update Gems 2018-04-18 15:19:30 -04:00
Gemfile.lock Update version and changelog 2018-04-19 13:04:46 -04:00
LICENSE Significant refactor and cleanup 2016-03-25 23:55:29 +00:00
Rakefile Fix specs 2018-04-18 15:20:18 -04:00
README.md Line break! 2018-04-18 17:12:06 -04:00
slugtastic.gemspec Update homepage 2018-04-18 17:14:13 -04:00

Slugtastic

Codeship Status for danbee/slugtastic

Gem Version

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

Requirements

  • Ruby 2.2.0+
  • Rails 5 or higher.

It will probably work just find with earlier versions--down to Rails 3.1 and Ruby 1.9.3--but it's not tested.

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