mongoid_taggable_on 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +9 -8
- data/lib/mongoid/taggable_on.rb +2 -2
- metadata +13 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b08b3db38743924d1e0f410742c9b3a0c8d5bb7c
|
4
|
+
data.tar.gz: 4da58b6cdf8b0a690234b76b72b5e7ca12a1e143
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cde2d9eb0ec7bb9bb27764f0ff761df3388a9612d91e7c23ff98968668d601bcda13fc4e082e677213d0ce75996a89e59bc9057dd606833c4575d58561db3472
|
7
|
+
data.tar.gz: 3c601bc33290396701f301883bddcd2abda8ca29d0dfd00dfd44d3a80438eb97669c8d86fd4afad2e5563e0cc0afa368b4f4d9ccf93de955e3098c6c9abaf3c7
|
data/README.md
CHANGED
@@ -4,7 +4,8 @@ Mongoid Taggable provides some helpers to create taggable documents, can use man
|
|
4
4
|
|
5
5
|
## Status
|
6
6
|
|
7
|
-
[![
|
7
|
+
- [![Gem Version](https://badge.fury.io/rb/mongoid_taggable_on.png)](https://rubygems.org/gems/mongoid_taggable_on)
|
8
|
+
- [![CI Status](https://api.travis-ci.org/huacnlee/mongoid_taggable_on.png)](http://travis-ci.org/huacnlee/mongoid_taggable_on)
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
|
@@ -22,7 +23,7 @@ gem 'mongoid_taggable_on'
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
25
|
-
[中文介绍去这里](http://huacnlee.com/blog/new_gem_mongoid_taggable_on)
|
26
|
+
[中文介绍去这里](http://huacnlee.com/blog/new_gem_mongoid_taggable_on)
|
26
27
|
|
27
28
|
```ruby
|
28
29
|
class Movie
|
@@ -32,36 +33,36 @@ class Movie
|
|
32
33
|
taggable_on :actors, :index => false
|
33
34
|
taggable_on :directors
|
34
35
|
taggable_on :countries
|
35
|
-
|
36
|
+
|
36
37
|
field :title
|
37
38
|
field :summary
|
38
39
|
end
|
39
40
|
```
|
40
|
-
|
41
|
+
|
41
42
|
Now you can use sample:
|
42
43
|
|
43
44
|
```bash
|
44
45
|
irb> m = Movie.new
|
45
|
-
irb> m.
|
46
|
+
irb> m.actor_list = "Jason Statham, Joseph Gordon-Levitt, Johnny Depp, Nicolas Cage"
|
46
47
|
irb> m.actors
|
47
48
|
["Jason Statham", "Joseph Gordon-Levitt", "Johnny De", "Nicolas Cage"]
|
48
49
|
irb> m.country_list = "United States| China|Mexico"
|
49
50
|
irb> m.countries
|
50
51
|
["United States","China","Mexico"]
|
51
52
|
```
|
52
|
-
|
53
|
+
|
53
54
|
find with tag:
|
54
55
|
|
55
56
|
```bash
|
56
57
|
irb> Movie.tagged_with_on(:actors, "Jason Statham, Joseph Gordon-Levitt")
|
57
58
|
irb> Movie.tagged_with_on(:actors, "Jason Statham, Joseph Gordon-Levitt", :match => :any)
|
58
|
-
irb> Movie.tagged_with_on(:actors, "Nicolas Cage", :match => :not)
|
59
|
+
irb> Movie.tagged_with_on(:actors, "Nicolas Cage", :match => :not)
|
59
60
|
```
|
60
61
|
|
61
62
|
## Allow split chars
|
62
63
|
|
63
64
|
, ,| /
|
64
|
-
|
65
|
+
|
65
66
|
## Who used that?
|
66
67
|
|
67
68
|
In [720p.so](http://720p.so), the Movie actors, directors, languages, countries, tags all base in mongoid\_taggable\_on.
|
data/lib/mongoid/taggable_on.rb
CHANGED
@@ -73,7 +73,7 @@ find items with tag
|
|
73
73
|
|
74
74
|
index_code = ""
|
75
75
|
if opts[:index] != false
|
76
|
-
index_code = "index({#{field_name}:
|
76
|
+
index_code = "index({#{field_name}: '2d'}, {background: true})"
|
77
77
|
end
|
78
78
|
|
79
79
|
class_eval %{
|
@@ -108,4 +108,4 @@ find items with tag
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
111
|
-
end
|
111
|
+
end
|
metadata
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_taggable_on
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jason Lee
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: mongoid
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 4.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 4.0.0
|
30
27
|
description: Mongoid Taggable provides some helpers to create taggable documents,
|
31
28
|
can use many fields.
|
32
29
|
email:
|
@@ -35,32 +32,32 @@ executables: []
|
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
35
|
+
- README.md
|
38
36
|
- lib/mongoid/taggable_on.rb
|
39
37
|
- lib/mongoid_taggable_on.rb
|
40
|
-
- README.md
|
41
38
|
homepage: https://github.com/huacnlee/mongoid_taggable_on
|
42
39
|
licenses: []
|
40
|
+
metadata: {}
|
43
41
|
post_install_message:
|
44
42
|
rdoc_options: []
|
45
43
|
require_paths:
|
46
44
|
- lib
|
47
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
46
|
requirements:
|
50
|
-
- -
|
47
|
+
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '0'
|
53
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
51
|
requirements:
|
56
|
-
- -
|
52
|
+
- - ">="
|
57
53
|
- !ruby/object:Gem::Version
|
58
54
|
version: '0'
|
59
55
|
requirements: []
|
60
56
|
rubyforge_project:
|
61
|
-
rubygems_version:
|
57
|
+
rubygems_version: 2.4.7
|
62
58
|
signing_key:
|
63
|
-
specification_version:
|
59
|
+
specification_version: 4
|
64
60
|
summary: Mongoid Taggable provides some helpers to create taggable documents, can
|
65
61
|
use many fields.
|
66
62
|
test_files: []
|
63
|
+
has_rdoc:
|