https://github.com/norman/friendly_id_sequel
An adapter which allows you to use FriendlyId with Sequel::Model
https://github.com/norman/friendly_id_sequel
Last synced: 7 months ago
JSON representation
An adapter which allows you to use FriendlyId with Sequel::Model
- Host: GitHub
- URL: https://github.com/norman/friendly_id_sequel
- Owner: norman
- License: mit
- Created: 2010-02-05T14:54:04.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2010-07-29T18:57:06.000Z (over 15 years ago)
- Last Synced: 2025-06-10T19:11:42.078Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 155 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
This is an in-development experimental adapter for
[FriendlyId](http://norman.github.com/friendly_id) using Sequel.
It currently supports all of FriendlyId's features except:
* Cached slugs
* Scoped slugs
* Rake tasks
* Rails Generator
Currently, only finds using `[]` are supported:
@post = Post["this-is-a-title"]
@post.friendly_id # this-is-a-title
## Usage
gem install friendly_id friendly_id_sequel
require "rubygems"
require "friendly_id"
require "friendly_id/sequel"
DB = Sequel.sqlite
FriendlyId::SequelAdapter::CreateSlugs.apply(DB, :up)
DB.create_table("books") do
primary_key :id, :type => Integer
string :name, :unique => true
string :note
end
class Book < Sequel::Model
plugin :friendly_id, :name, :use_slug => true
end
Book.create("name" => "Ficciones", "note" => "Jorge Luis Borges's classic short stories.")
p Book["ficciones"]
For more information on the available features, please see the
[FriendlyId Guide](http://norman.github.com/friendly_id/file.Guide.html).