metka 2.2.0 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{rubocop.yml → lint_code.yml} +1 -1
- data/.github/workflows/{docs.yml → lint_docs.yml} +0 -0
- data/.github/workflows/{rspec.yml → specs.yml} +4 -2
- data/.gitignore +2 -1
- data/.rubocop-md.yml +4 -1
- data/Gemfile.lock +92 -87
- data/README.md +54 -10
- data/gemfiles/{railsmaster.gemfile → railsmain.gemfile} +1 -1
- data/lib/metka/model.rb +1 -1
- data/lib/metka/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d20fb528eae6810bbc654f91a5b41d5b5b1a805074f3cd1b2d0e69f8e6df837e
|
4
|
+
data.tar.gz: 4f5c7b15b7f742dfcaecd99f465a1a6d8941d8e863fa04e79e766cfbff79c386
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cc8509f77851343ab5791e9058707e34bc49ae867b10bcd47462446d8cc9e7ac113d52319e02ace2bb8f92da40bd345b6d2bda36191f1e2815d496663a97bd4
|
7
|
+
data.tar.gz: 81bfa40d877fd4a04f2cb6b9cbd7529fdcb6fb376a8cca1e0db61f6eae307f84b60d098e4269f4e7e3b51f2a4e05357caa260798cf55fe8818cfdb073a8b9053
|
File without changes
|
@@ -1,10 +1,12 @@
|
|
1
|
-
name:
|
1
|
+
name: Specs
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
5
|
branches:
|
6
6
|
- master
|
7
7
|
pull_request:
|
8
|
+
schedule:
|
9
|
+
- cron: "0 3 * * 1" # Every monday at 3 AM
|
8
10
|
|
9
11
|
jobs:
|
10
12
|
rspec:
|
@@ -27,7 +29,7 @@ jobs:
|
|
27
29
|
include:
|
28
30
|
- ruby: "3.0"
|
29
31
|
postgres: "13"
|
30
|
-
gemfile: "gemfiles/
|
32
|
+
gemfile: "gemfiles/railsmain.gemfile"
|
31
33
|
fx: "false"
|
32
34
|
- ruby: "2.6"
|
33
35
|
postgres: "12"
|
data/.gitignore
CHANGED
data/.rubocop-md.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,143 +1,148 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
metka (2.1
|
4
|
+
metka (2.3.1)
|
5
5
|
dry-configurable (>= 0.8)
|
6
6
|
rails (>= 5.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.1.
|
12
|
-
actionpack (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
11
|
+
actioncable (6.1.4.1)
|
12
|
+
actionpack (= 6.1.4.1)
|
13
|
+
activesupport (= 6.1.4.1)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.1.
|
17
|
-
actionpack (= 6.1.
|
18
|
-
activejob (= 6.1.
|
19
|
-
activerecord (= 6.1.
|
20
|
-
activestorage (= 6.1.
|
21
|
-
activesupport (= 6.1.
|
16
|
+
actionmailbox (6.1.4.1)
|
17
|
+
actionpack (= 6.1.4.1)
|
18
|
+
activejob (= 6.1.4.1)
|
19
|
+
activerecord (= 6.1.4.1)
|
20
|
+
activestorage (= 6.1.4.1)
|
21
|
+
activesupport (= 6.1.4.1)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.1.
|
24
|
-
actionpack (= 6.1.
|
25
|
-
actionview (= 6.1.
|
26
|
-
activejob (= 6.1.
|
27
|
-
activesupport (= 6.1.
|
23
|
+
actionmailer (6.1.4.1)
|
24
|
+
actionpack (= 6.1.4.1)
|
25
|
+
actionview (= 6.1.4.1)
|
26
|
+
activejob (= 6.1.4.1)
|
27
|
+
activesupport (= 6.1.4.1)
|
28
28
|
mail (~> 2.5, >= 2.5.4)
|
29
29
|
rails-dom-testing (~> 2.0)
|
30
|
-
actionpack (6.1.
|
31
|
-
actionview (= 6.1.
|
32
|
-
activesupport (= 6.1.
|
30
|
+
actionpack (6.1.4.1)
|
31
|
+
actionview (= 6.1.4.1)
|
32
|
+
activesupport (= 6.1.4.1)
|
33
33
|
rack (~> 2.0, >= 2.0.9)
|
34
34
|
rack-test (>= 0.6.3)
|
35
35
|
rails-dom-testing (~> 2.0)
|
36
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
-
actiontext (6.1.
|
38
|
-
actionpack (= 6.1.
|
39
|
-
activerecord (= 6.1.
|
40
|
-
activestorage (= 6.1.
|
41
|
-
activesupport (= 6.1.
|
37
|
+
actiontext (6.1.4.1)
|
38
|
+
actionpack (= 6.1.4.1)
|
39
|
+
activerecord (= 6.1.4.1)
|
40
|
+
activestorage (= 6.1.4.1)
|
41
|
+
activesupport (= 6.1.4.1)
|
42
42
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (6.1.
|
44
|
-
activesupport (= 6.1.
|
43
|
+
actionview (6.1.4.1)
|
44
|
+
activesupport (= 6.1.4.1)
|
45
45
|
builder (~> 3.1)
|
46
46
|
erubi (~> 1.4)
|
47
47
|
rails-dom-testing (~> 2.0)
|
48
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (6.1.
|
50
|
-
activesupport (= 6.1.
|
49
|
+
activejob (6.1.4.1)
|
50
|
+
activesupport (= 6.1.4.1)
|
51
51
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (6.1.
|
53
|
-
activesupport (= 6.1.
|
54
|
-
activerecord (6.1.
|
55
|
-
activemodel (= 6.1.
|
56
|
-
activesupport (= 6.1.
|
57
|
-
activestorage (6.1.
|
58
|
-
actionpack (= 6.1.
|
59
|
-
activejob (= 6.1.
|
60
|
-
activerecord (= 6.1.
|
61
|
-
activesupport (= 6.1.
|
62
|
-
marcel (~> 0.
|
63
|
-
|
64
|
-
activesupport (6.1.
|
52
|
+
activemodel (6.1.4.1)
|
53
|
+
activesupport (= 6.1.4.1)
|
54
|
+
activerecord (6.1.4.1)
|
55
|
+
activemodel (= 6.1.4.1)
|
56
|
+
activesupport (= 6.1.4.1)
|
57
|
+
activestorage (6.1.4.1)
|
58
|
+
actionpack (= 6.1.4.1)
|
59
|
+
activejob (= 6.1.4.1)
|
60
|
+
activerecord (= 6.1.4.1)
|
61
|
+
activesupport (= 6.1.4.1)
|
62
|
+
marcel (~> 1.0.0)
|
63
|
+
mini_mime (>= 1.1.0)
|
64
|
+
activesupport (6.1.4.1)
|
65
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
66
|
i18n (>= 1.6, < 2)
|
67
67
|
minitest (>= 5.1)
|
68
68
|
tzinfo (~> 2.0)
|
69
69
|
zeitwerk (~> 2.3)
|
70
|
-
ammeter (1.1.
|
70
|
+
ammeter (1.1.5)
|
71
71
|
activesupport (>= 3.0)
|
72
72
|
railties (>= 3.0)
|
73
73
|
rspec-rails (>= 2.2)
|
74
74
|
builder (3.2.4)
|
75
75
|
coderay (1.1.3)
|
76
|
-
concurrent-ruby (1.1.
|
76
|
+
concurrent-ruby (1.1.9)
|
77
77
|
crass (1.0.6)
|
78
|
-
database_cleaner (
|
78
|
+
database_cleaner (2.0.1)
|
79
|
+
database_cleaner-active_record (~> 2.0.0)
|
80
|
+
database_cleaner-active_record (2.0.0)
|
81
|
+
activerecord (>= 5.a)
|
82
|
+
database_cleaner-core (~> 2.0.0)
|
83
|
+
database_cleaner-core (2.0.1)
|
79
84
|
diff-lcs (1.4.4)
|
80
|
-
dry-configurable (0.12.
|
85
|
+
dry-configurable (0.12.1)
|
81
86
|
concurrent-ruby (~> 1.0)
|
82
87
|
dry-core (~> 0.5, >= 0.5.0)
|
83
88
|
dry-core (0.5.0)
|
84
89
|
concurrent-ruby (~> 1.0)
|
85
90
|
erubi (1.10.0)
|
86
|
-
faker (2.
|
91
|
+
faker (2.17.0)
|
87
92
|
i18n (>= 1.6, < 2)
|
88
|
-
globalid (0.
|
89
|
-
activesupport (>=
|
90
|
-
i18n (1.8.
|
93
|
+
globalid (0.5.2)
|
94
|
+
activesupport (>= 5.0)
|
95
|
+
i18n (1.8.10)
|
91
96
|
concurrent-ruby (~> 1.0)
|
92
|
-
loofah (2.
|
97
|
+
loofah (2.12.0)
|
93
98
|
crass (~> 1.0.2)
|
94
99
|
nokogiri (>= 1.5.9)
|
95
100
|
mail (2.7.1)
|
96
101
|
mini_mime (>= 0.1.1)
|
97
|
-
marcel (0.
|
98
|
-
mimemagic (~> 0.3.2)
|
102
|
+
marcel (1.0.2)
|
99
103
|
method_source (1.0.0)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
mini_mime (1.1.1)
|
105
|
+
mini_portile2 (2.6.1)
|
106
|
+
minitest (5.14.4)
|
107
|
+
nio4r (2.5.8)
|
108
|
+
nokogiri (1.12.5)
|
109
|
+
mini_portile2 (~> 2.6.1)
|
110
|
+
racc (~> 1.4)
|
107
111
|
pg (1.2.3)
|
108
|
-
pry (0.
|
112
|
+
pry (0.14.0)
|
109
113
|
coderay (~> 1.1)
|
110
114
|
method_source (~> 1.0)
|
115
|
+
racc (1.5.2)
|
111
116
|
rack (2.2.3)
|
112
117
|
rack-test (1.1.0)
|
113
118
|
rack (>= 1.0, < 3)
|
114
|
-
rails (6.1.
|
115
|
-
actioncable (= 6.1.
|
116
|
-
actionmailbox (= 6.1.
|
117
|
-
actionmailer (= 6.1.
|
118
|
-
actionpack (= 6.1.
|
119
|
-
actiontext (= 6.1.
|
120
|
-
actionview (= 6.1.
|
121
|
-
activejob (= 6.1.
|
122
|
-
activemodel (= 6.1.
|
123
|
-
activerecord (= 6.1.
|
124
|
-
activestorage (= 6.1.
|
125
|
-
activesupport (= 6.1.
|
119
|
+
rails (6.1.4.1)
|
120
|
+
actioncable (= 6.1.4.1)
|
121
|
+
actionmailbox (= 6.1.4.1)
|
122
|
+
actionmailer (= 6.1.4.1)
|
123
|
+
actionpack (= 6.1.4.1)
|
124
|
+
actiontext (= 6.1.4.1)
|
125
|
+
actionview (= 6.1.4.1)
|
126
|
+
activejob (= 6.1.4.1)
|
127
|
+
activemodel (= 6.1.4.1)
|
128
|
+
activerecord (= 6.1.4.1)
|
129
|
+
activestorage (= 6.1.4.1)
|
130
|
+
activesupport (= 6.1.4.1)
|
126
131
|
bundler (>= 1.15.0)
|
127
|
-
railties (= 6.1.
|
132
|
+
railties (= 6.1.4.1)
|
128
133
|
sprockets-rails (>= 2.0.0)
|
129
134
|
rails-dom-testing (2.0.3)
|
130
135
|
activesupport (>= 4.2.0)
|
131
136
|
nokogiri (>= 1.6)
|
132
|
-
rails-html-sanitizer (1.
|
137
|
+
rails-html-sanitizer (1.4.2)
|
133
138
|
loofah (~> 2.3)
|
134
|
-
railties (6.1.
|
135
|
-
actionpack (= 6.1.
|
136
|
-
activesupport (= 6.1.
|
139
|
+
railties (6.1.4.1)
|
140
|
+
actionpack (= 6.1.4.1)
|
141
|
+
activesupport (= 6.1.4.1)
|
137
142
|
method_source
|
138
|
-
rake (>= 0.
|
143
|
+
rake (>= 0.13)
|
139
144
|
thor (~> 1.0)
|
140
|
-
rake (13.0.
|
145
|
+
rake (13.0.6)
|
141
146
|
rspec (3.10.0)
|
142
147
|
rspec-core (~> 3.10.0)
|
143
148
|
rspec-expectations (~> 3.10.0)
|
@@ -147,18 +152,18 @@ GEM
|
|
147
152
|
rspec-expectations (3.10.1)
|
148
153
|
diff-lcs (>= 1.2.0, < 2.0)
|
149
154
|
rspec-support (~> 3.10.0)
|
150
|
-
rspec-mocks (3.10.
|
155
|
+
rspec-mocks (3.10.2)
|
151
156
|
diff-lcs (>= 1.2.0, < 2.0)
|
152
157
|
rspec-support (~> 3.10.0)
|
153
|
-
rspec-rails (
|
154
|
-
actionpack (>=
|
155
|
-
activesupport (>=
|
156
|
-
railties (>=
|
158
|
+
rspec-rails (5.0.1)
|
159
|
+
actionpack (>= 5.2)
|
160
|
+
activesupport (>= 5.2)
|
161
|
+
railties (>= 5.2)
|
157
162
|
rspec-core (~> 3.10)
|
158
163
|
rspec-expectations (~> 3.10)
|
159
164
|
rspec-mocks (~> 3.10)
|
160
165
|
rspec-support (~> 3.10)
|
161
|
-
rspec-support (3.10.
|
166
|
+
rspec-support (3.10.2)
|
162
167
|
sprockets (4.0.2)
|
163
168
|
concurrent-ruby (~> 1.0)
|
164
169
|
rack (> 1, < 3)
|
@@ -166,11 +171,11 @@ GEM
|
|
166
171
|
actionpack (>= 4.0)
|
167
172
|
activesupport (>= 4.0)
|
168
173
|
sprockets (>= 3.0.0)
|
169
|
-
thor (1.0
|
170
|
-
timecop (0.9.
|
174
|
+
thor (1.1.0)
|
175
|
+
timecop (0.9.4)
|
171
176
|
tzinfo (2.0.4)
|
172
177
|
concurrent-ruby (~> 1.0)
|
173
|
-
websocket-driver (0.7.
|
178
|
+
websocket-driver (0.7.5)
|
174
179
|
websocket-extensions (>= 0.1.0)
|
175
180
|
websocket-extensions (0.1.5)
|
176
181
|
zeitwerk (2.4.2)
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/metka.svg)](https://badge.fury.io/rb/metka)
|
2
|
-
[![Build Status](https://github.com/jetrockets/metka/workflows/
|
2
|
+
[![Build Status](https://github.com/jetrockets/metka/workflows/Specs/badge.svg?branch=master)](https://github.com/jetrockets/metka/actions)
|
3
3
|
[![Open Source Helpers](https://www.codetriage.com/jetrockets/metka/badges/users.svg)](https://www.codetriage.com/jetrockets/metka)
|
4
4
|
|
5
5
|
# Metka
|
@@ -42,8 +42,8 @@ class CreateSongs < ActiveRecord::Migration[5.0]
|
|
42
42
|
def change
|
43
43
|
create_table :songs do |t|
|
44
44
|
t.string :title
|
45
|
-
t.string :tags, array: true
|
46
|
-
t.string :genres, array: true
|
45
|
+
t.string :tags, array: true, default: [], index: { using: :gin }
|
46
|
+
t.string :genres, array: true, default: [], index: { using: :gin }
|
47
47
|
t.timestamps
|
48
48
|
end
|
49
49
|
end
|
@@ -73,7 +73,10 @@ Song.with_all_tags('top, 1990')
|
|
73
73
|
#=> []
|
74
74
|
|
75
75
|
Song.with_all_tags('')
|
76
|
-
#=> []
|
76
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
77
|
+
|
78
|
+
Song.with_all_tags(nil)
|
79
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
77
80
|
|
78
81
|
Song.with_all_genres('rock')
|
79
82
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
@@ -89,7 +92,10 @@ Song.with_any_tags('chill, 1980')
|
|
89
92
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
90
93
|
|
91
94
|
Song.with_any_tags('')
|
92
|
-
#=> []
|
95
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
96
|
+
|
97
|
+
Song.with_any_tags(nil)
|
98
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
93
99
|
|
94
100
|
Song.with_any_genres('rock, rap')
|
95
101
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
@@ -105,7 +111,10 @@ Song.without_all_tags('top, 1990')
|
|
105
111
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
106
112
|
|
107
113
|
Song.without_all_tags('')
|
108
|
-
#=> []
|
114
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
115
|
+
|
116
|
+
Song.without_all_tags(nil)
|
117
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
109
118
|
|
110
119
|
Song.without_all_genres('rock, pop')
|
111
120
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
@@ -127,7 +136,10 @@ Song.without_any_genres('rock, pop')
|
|
127
136
|
#=> []
|
128
137
|
|
129
138
|
Song.without_any_genres('')
|
130
|
-
#=> []
|
139
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
140
|
+
|
141
|
+
Song.without_any_genres(nil)
|
142
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
131
143
|
```
|
132
144
|
|
133
145
|
### .tagged_with
|
@@ -140,7 +152,10 @@ Song.tagged_with('top, 1990')
|
|
140
152
|
#=> []
|
141
153
|
|
142
154
|
Song.tagged_with('')
|
143
|
-
#=> []
|
155
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
156
|
+
|
157
|
+
Song.tagged_with(nil)
|
158
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
144
159
|
|
145
160
|
Song.tagged_with('rock')
|
146
161
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
@@ -155,7 +170,7 @@ Song.tagged_with('chill, 1980', any: true)
|
|
155
170
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
156
171
|
|
157
172
|
Song.tagged_with('', any: true)
|
158
|
-
#=> []
|
173
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
159
174
|
|
160
175
|
Song.tagged_with('rock, rap', any: true, on: ['genres'])
|
161
176
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
@@ -167,7 +182,7 @@ Song.tagged_with('top, 1990', exclude: true)
|
|
167
182
|
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
168
183
|
|
169
184
|
Song.tagged_with('', exclude: true)
|
170
|
-
#=> []
|
185
|
+
#=> [#<Song id: 1, title: 'Migrate tags in Rails to PostgreSQL', tags: ['top', 'chill'], genres: ['rock', 'jazz', 'pop']]
|
171
186
|
|
172
187
|
Song.tagged_with('top, 1990', any: true, exclude: true)
|
173
188
|
#=> []
|
@@ -338,6 +353,35 @@ TBD
|
|
338
353
|
2. [ActsAsTaggableArrayOn](https://github.com/tmiyamon/acts-as-taggable-array-on)
|
339
354
|
3. [TagColumns](https://github.com/hopsoft/tag_columns)
|
340
355
|
|
356
|
+
## Migration from ActsAsTaggable
|
357
|
+
|
358
|
+
To migrate your data from `ActsAsTaggable` can be done with the following migration.
|
359
|
+
|
360
|
+
```ruby
|
361
|
+
class AddTagsToYourTable < ActiveRecord::Migration[6.0]
|
362
|
+
def change
|
363
|
+
add_column :your_table, :tags, :string, array: true
|
364
|
+
add_index :your_table, :tags, using: 'gin'
|
365
|
+
|
366
|
+
execute <<~SQL
|
367
|
+
UPDATE your_table
|
368
|
+
SET tags = tags.names
|
369
|
+
FROM (
|
370
|
+
SELECT taggings.taggable_id AS your_table_id,
|
371
|
+
array_agg(tags.name) as names
|
372
|
+
FROM tags
|
373
|
+
INNER JOIN taggings
|
374
|
+
ON tags.id = taggings.tag_id
|
375
|
+
WHERE
|
376
|
+
taggings.taggable_type = 'YouTableType'
|
377
|
+
GROUP BY taggings.taggable_id
|
378
|
+
) as tags
|
379
|
+
WHERE your_table.id = tags.your_table_id
|
380
|
+
SQL
|
381
|
+
end
|
382
|
+
end
|
383
|
+
```
|
384
|
+
|
341
385
|
## Benchmark Comparison
|
342
386
|
|
343
387
|
There are some results of benchmarking a performance of write, read and find operations for different gems, that provide solution for tagging. Keep in mind, that those results can't be used as a proof, that some solution is better than the others, since each of the benchmarked gems has their unique features. You could run the benchmarks yourself or check, what exact operations has been used for benchmarking, with [MetkaBench application](https://github.com/jetrockets/metka_bench).
|
data/lib/metka/model.rb
CHANGED
@@ -35,7 +35,7 @@ module Metka
|
|
35
35
|
cols = options.delete(:on)
|
36
36
|
parsed_tag_list = parser.call(tags)
|
37
37
|
|
38
|
-
return model
|
38
|
+
return model if parsed_tag_list.empty?
|
39
39
|
|
40
40
|
request = ::Metka::QueryBuilder.new.call(model, cols, parsed_tag_list, options)
|
41
41
|
model.where(request)
|
data/lib/metka/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Alexandrov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-configurable
|
@@ -188,9 +188,9 @@ extensions: []
|
|
188
188
|
extra_rdoc_files: []
|
189
189
|
files:
|
190
190
|
- ".github/ISSUE_TEMPLATE.md"
|
191
|
-
- ".github/workflows/
|
192
|
-
- ".github/workflows/
|
193
|
-
- ".github/workflows/
|
191
|
+
- ".github/workflows/lint_code.yml"
|
192
|
+
- ".github/workflows/lint_docs.yml"
|
193
|
+
- ".github/workflows/specs.yml"
|
194
194
|
- ".gitignore"
|
195
195
|
- ".mdlrc"
|
196
196
|
- ".rspec"
|
@@ -209,7 +209,7 @@ files:
|
|
209
209
|
- gemfiles/rails52.gemfile
|
210
210
|
- gemfiles/rails6.gemfile
|
211
211
|
- gemfiles/rails61.gemfile
|
212
|
-
- gemfiles/
|
212
|
+
- gemfiles/railsmain.gemfile
|
213
213
|
- gemfiles/rubocop.gemfile
|
214
214
|
- lib/generators/metka/strategies/materialized_view/materialized_view_generator.rb
|
215
215
|
- lib/generators/metka/strategies/materialized_view/templates/migration.rb.erb
|