forked from mbleigh/acts-as-taggable-on
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
65 lines (46 loc) · 2.26 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
ActsAsTaggableOn
================
This plugin is heavily based on Acts as Taggable on Steroids by Jonathan Viney. While
basic tagging functionality is handled expertly as well as tag cloud calculations, for
many applications there may be a need to have several "tag fields" for a given model.
For instance, in a social network, a user might have tags that are called skills,
interests, sports, and more. There is no real way to differentiate between tags and
so an implementation of this type is not possible with acts as taggable on steroids.
Enter Acts as Taggable On. Rather than tying functionality to a specific keyword
(namely "tags"), acts as taggable on allows you to specify an arbitrary number of
tag "contexts" that can be used locally or in combination in the same way steroids
was used.
Installation
============
The simplest way is just to install straight from the SVN:
script/plugin install http://svn.intridea.com/svn/public/acts_as_taggable_on
Testing
=======
Acts As Taggable On uses RSpec for its test coverage. If you already have RSpec on your
application, the specs will run while using:
rake spec:plugins
Example
=======
class User < ActiveRecord::Base
acts_as_taggable_on :tags, :skills, :interests
end
@user = User.new(:name => "Bobby")
@user.tag_list = "awesome, slick, hefty" # this should be familiar
@user.skill_list = "joking, clowning, boxing" # but you can do it for any context!
@user.skill_list # => ["joking","clowning","boxing"] as TagList
@user.save
@user.tags # => [<Tag name:"awesome">,<Tag name:"slick">,<Tag name:"hefty">]
@user.skills # => => [<Tag name:"joking">,<Tag name:"clowning">,<Tag name:"boxing">]
User.find_tagged_with("awesome") # => [@user]
User.find_tagged_with("joking") # => [@user]
User.find_tagged_with("awesome", :on => :tags) # => [@user]
User.find_tagged_with("awesome", :on => :skills) # => []
Caveats, Uncharted Waters
=========================
This plugin is still under active development. Plugin caching and tag cloud calculations
have not been thoroughly (or even partially) tested and may not work as expected.
Resources
=========
SVN - http://svn.intridea.com/svn/public/acts_as_taggable_on
Trac - http://trac.intridea.com/trac/public
Copyright (c) 2007 Michael Bleigh and Intridea Inc., released under the MIT license