Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An adapter which allows you to use FriendlyId with Sequel::Model

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile.default
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 example.rb
Octocat-spinner-32 friendly_id_sequel.gemspec
README.md

This is an in-development experimental adapter for FriendlyId 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.

Something went wrong with that request. Please try again.