Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 43 lines (21 sloc) 0.676 kB
99819fb @jackdempsey update readme and remove created_at for the time being
authored
1 = Sequel::Taggable
2
3 A simple plugin for Sequel::Model's that lets you work with tags. To use simply declare "is :taggable" in your model.
4
5 == Example
6
7 For easy cut & paste testing, here's a setup for an irb session. You can find the same schema Sequel::Taggable uses in sequel_taggable/migration.rb
8
9 require 'rubygems'
10 require 'sequel'
11
12 DB = Sequel.sqlite
13
14 require 'sequel_taggable/migration'
15
16 CreateTags.apply(DB, :up)
17
18 class Article < Sequel::Model
19 set_schema do
20 primary_key :id
21 varchar :name
22 end
23
24 is :taggable
25 end
26
27 Article.create_table
28
29 a = Article.create(:name => "Example article")
30
31 t = Tag.create(:name => "tag one")
32
33 a.add_tag(t)
34
35 pp Tagging.all
36
37
38
39
40
41
42
Something went wrong with that request. Please try again.