unidom-category 1.6.4 → 1.6.5
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4fe54df3292fb56eb4eb3a53e3ea8dbf54be27a
|
4
|
+
data.tar.gz: c1e51b4ac7559bda765f160feadf2859f6e446ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab0717de01b7e3bfc7bbb5e4ec874dd6ac87433d66580f606667c4c2c7c659bc386ef7b00bb309ee72044bd5a227eac0785914ba95c569068766e927d869084
|
7
|
+
data.tar.gz: 4fb1666ffe7548bc2adae07132f70db1d383a5dae68250e1bd6c0dc67cdaaae2050f7b19cefcb81af8c4e34851e057dcc7a0fa1c9b60264745ced260f8fda5de
|
@@ -14,8 +14,8 @@ class Unidom::Category::CategoryRollup < Unidom::Category::ApplicationRecord
|
|
14
14
|
|
15
15
|
scope :apart, ->(distance = 1) { where distance: distance }
|
16
16
|
|
17
|
-
scope :ancestor_category_is, ->(category) { where ancestor_category_id: (category
|
18
|
-
scope :descendant_category_is, ->(category) { where descendant_category_id: (category
|
17
|
+
scope :ancestor_category_is, ->(category) { where ancestor_category_id: to_id(category) }
|
18
|
+
scope :descendant_category_is, ->(category) { where descendant_category_id: to_id(category) }
|
19
19
|
|
20
20
|
after_create ->(record) {
|
21
21
|
return unless 1==record.distance
|
@@ -25,6 +25,8 @@ describe Unidom::Category::Categorizing, type: :model do
|
|
25
25
|
|
26
26
|
it_behaves_like 'belongs_to', model_attributes, :category, Unidom::Category::Category, category_attributes
|
27
27
|
|
28
|
+
it_behaves_like 'monomorphic scope', model_attributes, :category_is, :category
|
29
|
+
|
28
30
|
end
|
29
31
|
|
30
32
|
end
|
@@ -25,6 +25,9 @@ describe Unidom::Category::CategoryRollup, type: :model do
|
|
25
25
|
it_behaves_like 'belongs_to', model_attributes, :ancestor_category, Unidom::Category::Category, category_attributes
|
26
26
|
it_behaves_like 'belongs_to', model_attributes, :descendant_category, Unidom::Category::Category, category_attributes
|
27
27
|
|
28
|
+
it_behaves_like 'monomorphic scope', model_attributes, :ancestor_category_is, :ancestor_category
|
29
|
+
it_behaves_like 'monomorphic scope', model_attributes, :descendant_category_is, :descendant_category
|
30
|
+
|
28
31
|
end
|
29
32
|
|
30
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-category
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|