mirror of
https://github.com/danbee/slugtastic
synced 2025-03-04 08:49:05 +00:00
Update index.md
This commit is contained in:
parent
f4d73a09cb
commit
67f2979334
22
index.md
22
index.md
@ -1,19 +1,25 @@
|
|||||||
# Slugtastic
|
# Slugtastic
|
||||||
|
|
||||||
Simple gem for autogenerating permalink style slugs for your ActiveRecord models.
|
[](https://codeship.com/projects/30797)
|
||||||
|
|
||||||
|
[](https://badge.fury.io/rb/slugtastic)
|
||||||
|
|
||||||
|
Simple gem for autogenerating permalink style slugs for your ActiveRecord
|
||||||
|
models.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* Ruby 1.9.2 or 1.9.3
|
* Ruby 2.2.0+
|
||||||
* Rails 3.1 or higher.
|
* Rails 5 or higher.
|
||||||
|
|
||||||
It should work with Rails 3.0 but it hasn't been tested.
|
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
|
## Installation
|
||||||
|
|
||||||
Add this line to your application's Gemfile:
|
Add this line to your application's Gemfile:
|
||||||
|
|
||||||
gem 'slugtastic'
|
gem "slugtastic"
|
||||||
|
|
||||||
And then execute:
|
And then execute:
|
||||||
|
|
||||||
@ -27,9 +33,11 @@ Or install it yourself as:
|
|||||||
|
|
||||||
Usage is very simple. Just add the following to your model:
|
Usage is very simple. Just add the following to your model:
|
||||||
|
|
||||||
has_slug :slug, :from => :title
|
slug :slug, from: :title
|
||||||
|
|
||||||
This will generate a slug string from the title atrribute 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`.
|
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.
|
There are no extra options at present.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user