tag_columns 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/tag_columns.rb +15 -2
- data/lib/tag_columns/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f2da2f8b26c73aa0c1694483cbd928b362771462c38660e0f97ac23eea636cd
|
4
|
+
data.tar.gz: 6dd4f9e84216e504ffe753d2f408458be29dbb2cde2464841fc859d744654e47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a42f325d2d7d2248b4c509d19182adfc1e78abd91bdde7cf4c77e918c79d07bdcdc6faee78e32fd64208d2099be263a87c3de92b032609b8f12a7dbe0842f1aa
|
7
|
+
data.tar.gz: 2cf4f50c56ee9d718b521a1df50c9798e23556bbcd0b107ee6119240ba2c32f29f336c5ac0bbd1fd18c65565e6e234c808a9a3a0b31b1aa59e5614de96cae5cc
|
data/Gemfile.lock
CHANGED
data/lib/tag_columns.rb
CHANGED
@@ -56,8 +56,21 @@ module TagColumns
|
|
56
56
|
where contains
|
57
57
|
}
|
58
58
|
|
59
|
-
scope :"without_any_#{method_name}", ->(*tags) {
|
60
|
-
|
59
|
+
scope :"without_any_#{method_name}", ->(*tags) {
|
60
|
+
column_cast = Arel::Nodes::NamedFunction.new("CAST", [arel_table[column_name].as("text[]")])
|
61
|
+
value = Arel::Nodes::SqlLiteral.new(sanitize_sql_array(["ARRAY[?]", tag_columns_sanitize_list(tags)]))
|
62
|
+
value_cast = Arel::Nodes::NamedFunction.new("CAST", [value.as("text[]")])
|
63
|
+
overlap = Arel::Nodes::InfixOperation.new("&&", column_cast, value_cast)
|
64
|
+
where.not overlap
|
65
|
+
}
|
66
|
+
|
67
|
+
scope :"without_all_#{method_name}", ->(*tags) {
|
68
|
+
column_cast = Arel::Nodes::NamedFunction.new("CAST", [arel_table[column_name].as("text[]")])
|
69
|
+
value = Arel::Nodes::SqlLiteral.new(sanitize_sql_array(["ARRAY[?]", tag_columns_sanitize_list(tags)]))
|
70
|
+
value_cast = Arel::Nodes::NamedFunction.new("CAST", [value.as("text[]")])
|
71
|
+
contains = Arel::Nodes::InfixOperation.new("@>", column_cast, value_cast)
|
72
|
+
where.not contains
|
73
|
+
}
|
61
74
|
|
62
75
|
before_validation -> { self[column_name] = self.class.tag_columns_sanitize_list(self[column_name]) }
|
63
76
|
|
data/lib/tag_columns/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tag_columns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|