0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
Simple friendly url generator for ActiveRecord with history.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

~> 1.8.7
>= 4.0.0, < 7.2
 Project Readme

SimpleSlug

Build Status

Simple friendly url generator for ActiveRecord models with history.

Installation

Add this line to your application's Gemfile:

gem 'simple_slug'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_slug

Usage

Add basic slugs to your model:

class User < ActiveRecord::Base
  simple_slug :full_name
end

Or with custom slug column and history:

class User < ActiveRecord::Base
  simple_slug :full_name, slug_column: 'my_slug_column', history: true
end

Add localization with slug_YOUR_LOCALE like columns:

class User < ActiveRecord::Base
  simple_slug :full_name, locales: [nil, :it]
end

If you want to control when slug is generated, define should_generate_new_slug? method:

class User < ActiveRecord::Base
  simple_slug :full_name

  def should_generate_new_slug?
    true
  end
end

Contributing

  1. Fork it ( http://github.com/leschenko/simple_slug/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request