minimal_tags 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/README.md +10 -2
- data/gemfiles/activerecord_41.gemfile +5 -0
- data/gemfiles/activerecord_42.gemfile +5 -0
- data/gemfiles/activerecord_50.gemfile +5 -0
- data/lib/minimal_tags/persistence/activerecord.rb +4 -0
- data/lib/minimal_tags/persistence/mongoid.rb +3 -1
- data/lib/minimal_tags/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2892db32ac72c1bdf42d1b12843f36931b53e1d
|
4
|
+
data.tar.gz: dd1ee091b5c7af7692393c187ea329f383a8fb13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f26d5dee52d5a0d7d603f9edc2855aa7601f7372034bae34d83eac6a8789a53bbf801632701ad1295ce6cbaf28c7218521bda05b6f9f9d48b0a5be4052354c
|
7
|
+
data.tar.gz: 4d67ee35a403d6ff2249443ca7fe3a5b650e741983890dfb7d1e0df9093e764db90dbb6b8d0404129b93b5da7bd38ec70cc556fe20448a43d6b341a860c205f9
|
data/.travis.yml
CHANGED
@@ -3,6 +3,10 @@ rvm:
|
|
3
3
|
- 2.1.0
|
4
4
|
- 2.2.3
|
5
5
|
- 2.3.0
|
6
|
+
gemfile:
|
7
|
+
- gemfiles/activerecord_41.gemfile
|
8
|
+
- gemfiles/activerecord_42.gemfile
|
9
|
+
- gemfiles/activerecord_50.gemfile
|
6
10
|
services:
|
7
11
|
- mongodb
|
8
12
|
- postgresql
|
@@ -13,3 +17,6 @@ before_script:
|
|
13
17
|
addons:
|
14
18
|
code_climate:
|
15
19
|
repo_token: 3c954617ba40beceb056cc73b82e00a6dc1fa2193cda386dc6c2128bdd61a804
|
20
|
+
matrix:
|
21
|
+
allow_failures:
|
22
|
+
- gemfile: gemfiles/activerecord_50.gemfile
|
data/README.md
CHANGED
@@ -52,15 +52,23 @@ end
|
|
52
52
|
```
|
53
53
|
|
54
54
|
You can define multiple tag fields, just ensure they have unique names.
|
55
|
-
Formatters can be defined on each tag field if needed, otherwise the default be used.
|
55
|
+
Formatters can be defined on each tag field if needed, otherwise the default, [MinimalTags::SimpleFormatter](https://github.com/harrisbaird/minimal_tags/blob/master/lib/minimal_tags/simple_formatter.rb) be used.
|
56
|
+
|
57
|
+
### Changing the default formatter
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
MinimalTags.default_formatter = UnderscoreTagFormatter.new
|
61
|
+
```
|
56
62
|
|
57
63
|
## Searching
|
58
64
|
The following scopes are also added for each tag field and can be chained:
|
59
|
-
`.any_*`, `.all_*`
|
65
|
+
`.any_*`, `.all_*`, `.without_any_*`, `.without_all_*`
|
60
66
|
|
61
67
|
```ruby
|
62
68
|
Document.any_tags(['a', 'b', 'c'])
|
63
69
|
Document.all_tags(['a', 'b', 'c'])
|
70
|
+
Document.without_any_tags(['a', 'b', 'c'])
|
71
|
+
Document.without_all_tags(['a', 'b', 'c'])
|
64
72
|
```
|
65
73
|
|
66
74
|
## Contributing
|
@@ -31,6 +31,10 @@ module MinimalTags
|
|
31
31
|
scope "#{prefix}_#{field_name}", lambda { |tags|
|
32
32
|
where("#{field_name} #{operator} ARRAY[?]", formatter.normalize(tags))
|
33
33
|
}
|
34
|
+
|
35
|
+
scope "without_#{prefix}_#{field_name}", lambda { |tags|
|
36
|
+
where.not("#{field_name} #{operator} ARRAY[?]", formatter.normalize(tags))
|
37
|
+
}
|
34
38
|
end
|
35
39
|
|
36
40
|
# Normalize tags on save
|
data/lib/minimal_tags/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minimal_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- harrisbaird
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -146,6 +146,9 @@ files:
|
|
146
146
|
- Gemfile
|
147
147
|
- README.md
|
148
148
|
- Rakefile
|
149
|
+
- gemfiles/activerecord_41.gemfile
|
150
|
+
- gemfiles/activerecord_42.gemfile
|
151
|
+
- gemfiles/activerecord_50.gemfile
|
149
152
|
- lib/minimal_tags.rb
|
150
153
|
- lib/minimal_tags/persistence/activerecord.rb
|
151
154
|
- lib/minimal_tags/persistence/mongoid.rb
|