acts-as-taggable-array-on 0.5 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f7a6cf023c1dd9dd7f1d8e77db2772f2f673b233d5f2ad625115c0d28677879
|
4
|
+
data.tar.gz: 84d46e102ab941b3a1a99c85ed2897ef5b09785f1c40a65356365710d3f500cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e6efedde0a9883e69acad7fc544daca55f0c8cd6a447cd65cdc77ba4c47380c61d3b93eb51c9378b98bd753af086afa61b90375418acd93e98b77e7ef7ec1bb
|
7
|
+
data.tar.gz: 84e04cfc82640c5137aa59cecb8fbe7bd55d357509ac9fc3b8ae60b7eca25339f2fc933be711026bcc5e0511fc3af7c95ed290b0edd02247088e9578ac82d6ba
|
data/CHANGELOG.md
ADDED
@@ -9,15 +9,14 @@ module ActsAsTaggableArrayOn
|
|
9
9
|
TYPE_MATCHER = { string: 'varchar', text: 'text', integer: 'integer' }
|
10
10
|
|
11
11
|
module ClassMethod
|
12
|
-
def acts_as_taggable_array_on(*
|
13
|
-
|
14
|
-
tag_array_type = TYPE_MATCHER[columns_hash[tag_name.to_s].try(:type)]
|
12
|
+
def acts_as_taggable_array_on(tag_name, *)
|
13
|
+
tag_array_type_fetcher = -> { TYPE_MATCHER[columns_hash[tag_name.to_s].type] }
|
15
14
|
parser = ActsAsTaggableArrayOn.parser
|
16
15
|
|
17
|
-
scope :"with_any_#{tag_name}", ->(tags){ where("#{table_name}.#{tag_name} && ARRAY[?]::#{
|
18
|
-
scope :"with_all_#{tag_name}", ->(tags){ where("#{table_name}.#{tag_name} @> ARRAY[?]::#{
|
19
|
-
scope :"without_any_#{tag_name}", ->(tags){ where.not("#{table_name}.#{tag_name} && ARRAY[?]::#{
|
20
|
-
scope :"without_all_#{tag_name}", ->(tags){ where.not("#{table_name}.#{tag_name} @> ARRAY[?]::#{
|
16
|
+
scope :"with_any_#{tag_name}", ->(tags) { where("#{table_name}.#{tag_name} && ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
|
17
|
+
scope :"with_all_#{tag_name}", ->(tags) { where("#{table_name}.#{tag_name} @> ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
|
18
|
+
scope :"without_any_#{tag_name}", ->(tags) { where.not("#{table_name}.#{tag_name} && ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
|
19
|
+
scope :"without_all_#{tag_name}", ->(tags) { where.not("#{table_name}.#{tag_name} @> ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
|
21
20
|
|
22
21
|
self.class.class_eval do
|
23
22
|
define_method :"all_#{tag_name}" do |options = {}, &block|
|
@@ -14,12 +14,8 @@ describe ActsAsTaggableArrayOn::Taggable do
|
|
14
14
|
|
15
15
|
context "without database table" do
|
16
16
|
it "doesn't fail on class method call" do
|
17
|
-
Temping.create :dummy
|
18
|
-
|
19
17
|
class Dummy < ActiveRecord::Base; end
|
20
18
|
Dummy.acts_as_taggable_array_on :tags
|
21
|
-
|
22
|
-
Temping.teardown
|
23
19
|
end
|
24
20
|
end
|
25
21
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
4
|
require 'active_record/railtie'
|
5
|
-
require 'temping'
|
6
5
|
ActiveRecord::Base.logger = Logger.new(STDERR)
|
7
6
|
ActiveRecord::Base.logger.level = 3
|
8
7
|
|
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:
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takuya Miyamoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -122,20 +122,6 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.0.0
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: temping
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
125
|
description: Simple tagging gem for Rails using postgres array.
|
140
126
|
email:
|
141
127
|
- miyamototakuya@gmail.com
|
@@ -146,6 +132,7 @@ files:
|
|
146
132
|
- ".editorconfig"
|
147
133
|
- ".gitignore"
|
148
134
|
- ".travis.yml"
|
135
|
+
- CHANGELOG.md
|
149
136
|
- Gemfile
|
150
137
|
- Guardfile
|
151
138
|
- LICENSE.txt
|