tagalong 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/tagalong/taggable.rb +2 -2
- data/lib/tagalong/tagger.rb +2 -2
- data/lib/tagalong/version.rb +1 -1
- metadata +7 -7
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Tagalong
|
2
2
|
|
3
|
-
Tagalong is a Rails plugin that is intended to be
|
3
|
+
Tagalong is a Rails plugin that is intended to be clean, efficient, and simple. I have tried very hard to have the API make sense in terms of OOP as I have seen many other tagging libraries that I don't think do a great job of this.
|
4
4
|
|
5
5
|
The other key differentiation between Tagalong and many of the other tagging libraries out there is the relational database structure behind the scenes. This allows us to differentiate this tagging plugin in the following ways:
|
6
6
|
|
@@ -86,7 +86,7 @@ Passing a taggable object to the tags method on the Tagger will return a list of
|
|
86
86
|
|
87
87
|
### List taggables that have a tag
|
88
88
|
|
89
|
-
You can
|
89
|
+
You can acquire an array of taggable objects that have a given tag using the `taggables_with` method on the Tagger object as follows:
|
90
90
|
|
91
91
|
@user.taggables_with('some_tag')
|
92
92
|
# => [Taggable Object, Taggable Object] (in this case Taggable Objects would be Contacts)
|
data/lib/tagalong/taggable.rb
CHANGED
@@ -16,11 +16,11 @@ module Tagalong
|
|
16
16
|
|
17
17
|
module InstanceMethods
|
18
18
|
def has_tag?(name)
|
19
|
-
return self.tagalong_tags.map { |r| r.name }.include?(name)
|
19
|
+
return self.tagalong_tags(true).map { |r| r.name }.include?(name)
|
20
20
|
end
|
21
21
|
|
22
22
|
def tags
|
23
|
-
return self.tagalong_tags.order("number_of_references DESC").map { |r| r.name }
|
23
|
+
return self.tagalong_tags(true).order("number_of_references DESC").map { |r| r.name }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/tagalong/tagger.rb
CHANGED
@@ -28,9 +28,9 @@ module Tagalong
|
|
28
28
|
|
29
29
|
def tags(taggable = nil)
|
30
30
|
if taggable == nil
|
31
|
-
return self.tagalong_tags.order("number_of_references DESC").map { |r| r.name }
|
31
|
+
return self.tagalong_tags(true).order("number_of_references DESC").map { |r| r.name }
|
32
32
|
else
|
33
|
-
return self.tagalong_tags.joins("LEFT OUTER JOIN tagalong_taggings ON tagalong_taggings.tagalong_tag_id = tagalong_tags.id").select("tagalong_tags.id, tagalong_tags.name, tagalong_tags.number_of_references, tagalong_taggings.id as used").order("number_of_references DESC").map { |r| { :tag => r.name, :used => !r.used.nil?, :number_of_references => r.number_of_references } }
|
33
|
+
return self.tagalong_tags(true).joins("LEFT OUTER JOIN tagalong_taggings ON tagalong_taggings.tagalong_tag_id = tagalong_tags.id").select("tagalong_tags.id, tagalong_tags.name, tagalong_tags.number_of_references, tagalong_taggings.id as used").order("number_of_references DESC").map { |r| { :tag => r.name, :used => !r.used.nil?, :number_of_references => r.number_of_references } }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
data/lib/tagalong/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagalong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &70212871717240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70212871717240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &70212871716800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70212871716800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70212871716300 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70212871716300
|
47
47
|
description: A Rails tagging plugin that makes sense.
|
48
48
|
email:
|
49
49
|
- cyphactor@gmail.com
|