acts-as-taggable-array-on 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -12
- data/CHANGELOG.md +5 -0
- data/README.md +3 -4
- data/acts-as-taggable-array-on.gemspec +5 -5
- data/config/database.yml.travis +3 -0
- data/gemfiles/{rails_5.gemfile → rails_5_2.gemfile} +2 -2
- data/gemfiles/{rails_4.gemfile → rails_6_0.gemfile} +2 -2
- data/lib/acts-as-taggable-array-on/taggable.rb +2 -1
- data/lib/acts-as-taggable-array-on/version.rb +1 -1
- data/spec/acts_as_tag_pgarray/taggable_spec.rb +18 -3
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad1ac43607f0f09763e87b8f283f01652a6176d74d7bb5d2c8685453a10501fc
|
4
|
+
data.tar.gz: 31dadff61892909368696d09fb5248ec08786ac41333e315581325cf17b707a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae034e443e607c4de43fe8df98fdccd89f15eb9cba552fd98c6fd8d97f238207271fbf2861adb5aef45c1ad9c3c534ad100a45eaad252baf62bf8c232037f44a
|
7
|
+
data.tar.gz: e4b432be275ff891566b7f336c794980a74e6943cd7152610190c386e54c11c3a1c12b79466678a4e27d72cf945dd247960a917de8504733c6f3fa51a3b28754
|
data/.travis.yml
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
|
7
|
-
-
|
8
|
-
- 2.5.0
|
9
|
-
addons:
|
10
|
-
postgresql: 9.3
|
3
|
+
- 2.4.8
|
4
|
+
- 2.5.7
|
5
|
+
- 2.6.5
|
6
|
+
services:
|
7
|
+
- postgresql
|
11
8
|
gemfile:
|
12
|
-
- gemfiles/
|
13
|
-
- gemfiles/
|
9
|
+
- gemfiles/rails_5_2.gemfile
|
10
|
+
- gemfiles/rails_6_0.gemfile
|
14
11
|
before_script:
|
12
|
+
- cp config/database.yml.travis config/database.yml
|
15
13
|
- bundle exec rake db:create
|
16
14
|
script:
|
17
15
|
- bundle
|
18
16
|
- bundle exec rspec
|
19
17
|
matrix:
|
20
18
|
exclude:
|
21
|
-
- rvm: 2.
|
22
|
-
gemfile: gemfiles/
|
19
|
+
- rvm: 2.4.8
|
20
|
+
gemfile: gemfiles/rails_6_0.gemfile
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# ActsAsTaggableArrayOn
|
2
2
|
[![Build Status](https://travis-ci.org/tmiyamon/acts-as-taggable-array-on.svg?branch=master)](https://travis-ci.org/tmiyamon/acts-as-taggable-array-on)
|
3
3
|
|
4
|
-
A simple implementation for tagging system with postgres array.
|
5
|
-
So, this gem works only on postgres.
|
4
|
+
A simple implementation for tagging system with postgres array. Please note, only PostgreSql database is supported.
|
6
5
|
|
7
6
|
|
8
7
|
## Installation
|
@@ -46,7 +45,7 @@ then
|
|
46
45
|
|
47
46
|
```ruby
|
48
47
|
class User < ActiveRecord::Base
|
49
|
-
|
48
|
+
taggable_array :tags
|
50
49
|
end
|
51
50
|
@user = User.new(:name => "Bobby")
|
52
51
|
```
|
@@ -96,7 +95,7 @@ Set, add and remove
|
|
96
95
|
|
97
96
|
```ruby
|
98
97
|
class User < ActiveRecord::Base
|
99
|
-
|
98
|
+
taggable_array :tags
|
100
99
|
scope :by_join_date, ->{order("created_at DESC")}
|
101
100
|
end
|
102
101
|
|
@@ -18,14 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'activerecord', ['>=
|
22
|
-
spec.add_runtime_dependency 'activesupport', ['>=
|
21
|
+
spec.add_runtime_dependency 'activerecord', ['>= 5.2']
|
22
|
+
spec.add_runtime_dependency 'activesupport', ['>= 5.2']
|
23
23
|
|
24
|
-
spec.add_development_dependency 'pg', '~>
|
24
|
+
spec.add_development_dependency 'pg', '~> 1.1'
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "bundler"
|
27
27
|
spec.add_development_dependency "rake"
|
28
28
|
spec.add_development_dependency "rspec-rails"
|
29
29
|
spec.add_development_dependency "guard-rspec"
|
30
|
-
spec.add_development_dependency "listen",
|
30
|
+
spec.add_development_dependency "listen", "> 3.0"
|
31
31
|
end
|
@@ -30,10 +30,11 @@ module ActsAsTaggableArrayOn
|
|
30
30
|
subquery_scope = unscoped.select("unnest(#{table_name}.#{tag_name}) as tag")
|
31
31
|
subquery_scope = subquery_scope.instance_eval(&block) if block
|
32
32
|
|
33
|
-
from(subquery_scope).group('tag').order('tag').pluck('tag, count(*) as count')
|
33
|
+
from(subquery_scope).group('tag').order('tag').pluck(Arel.sql('tag, count(*) as count'))
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
alias taggable_array acts_as_taggable_array_on
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -8,7 +8,7 @@ describe ActsAsTaggableArrayOn::Taggable do
|
|
8
8
|
|
9
9
|
User.acts_as_taggable_array_on :colors
|
10
10
|
User.acts_as_taggable_array_on :sizes
|
11
|
-
User.
|
11
|
+
User.taggable_array :codes
|
12
12
|
end
|
13
13
|
|
14
14
|
|
@@ -34,6 +34,21 @@ describe ActsAsTaggableArrayOn::Taggable do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
describe "#taggable_array_on" do
|
38
|
+
it "defines named scope to match any tags" do
|
39
|
+
expect(User).to respond_to(:with_any_codes)
|
40
|
+
end
|
41
|
+
it "defines named scope to match all tags" do
|
42
|
+
expect(User).to respond_to(:with_all_codes)
|
43
|
+
end
|
44
|
+
it "defines named scope not to match any tags" do
|
45
|
+
expect(User).to respond_to(:without_any_codes)
|
46
|
+
end
|
47
|
+
it "defines named scope not to match all tags" do
|
48
|
+
expect(User).to respond_to(:without_all_codes)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
37
52
|
it 'should define table name un-ambiguously' do
|
38
53
|
sql = User.with_any_sizes(['small']).to_sql
|
39
54
|
expect(sql).to eql("SELECT \"users\".* FROM \"users\" WHERE (users.sizes && ARRAY['small']::text[])")
|
@@ -42,10 +57,10 @@ describe ActsAsTaggableArrayOn::Taggable do
|
|
42
57
|
expect(sql).to eql("SELECT \"users\".* FROM \"users\" WHERE (users.sizes @> ARRAY['small']::text[])")
|
43
58
|
|
44
59
|
sql = User.without_any_sizes(['small']).to_sql
|
45
|
-
expect(sql).to eql("SELECT \"users\".* FROM \"users\" WHERE
|
60
|
+
expect(sql).to eql("SELECT \"users\".* FROM \"users\" WHERE NOT (users.sizes && ARRAY['small']::text[])")
|
46
61
|
|
47
62
|
sql = User.without_all_sizes(['small']).to_sql
|
48
|
-
expect(sql).to eql("SELECT \"users\".* FROM \"users\" WHERE
|
63
|
+
expect(sql).to eql("SELECT \"users\".* FROM \"users\" WHERE NOT (users.sizes @> ARRAY['small']::text[])")
|
49
64
|
end
|
50
65
|
|
51
66
|
it "should work with ::text typed array" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts-as-taggable-array-on
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takuya Miyamoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pg
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: listen
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.0
|
117
|
+
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 3.0
|
124
|
+
version: '3.0'
|
125
125
|
description: Simple tagging gem for Rails using postgres array.
|
126
126
|
email:
|
127
127
|
- miyamototakuya@gmail.com
|
@@ -139,8 +139,9 @@ files:
|
|
139
139
|
- README.md
|
140
140
|
- Rakefile
|
141
141
|
- acts-as-taggable-array-on.gemspec
|
142
|
-
-
|
143
|
-
- gemfiles/
|
142
|
+
- config/database.yml.travis
|
143
|
+
- gemfiles/rails_5_2.gemfile
|
144
|
+
- gemfiles/rails_6_0.gemfile
|
144
145
|
- lib/acts-as-taggable-array-on.rb
|
145
146
|
- lib/acts-as-taggable-array-on/parser.rb
|
146
147
|
- lib/acts-as-taggable-array-on/taggable.rb
|
@@ -168,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
- !ruby/object:Gem::Version
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
|
-
|
172
|
-
rubygems_version: 2.7.6
|
172
|
+
rubygems_version: 3.0.3
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Simple tagging gem for Rails using postgres array.
|