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: 38c44b2f62ee1f832d41e913ffb95093963b4478
4
- data.tar.gz: e66d461ea52778fecaa594f724463bd1b9e25d5c
3
+ metadata.gz: d4fe54df3292fb56eb4eb3a53e3ea8dbf54be27a
4
+ data.tar.gz: c1e51b4ac7559bda765f160feadf2859f6e446ef
5
5
  SHA512:
6
- metadata.gz: 3a9af58754fe3d73f689ec46ecadbb312a3fd8c99cbf152044fda4ca172cbe2212f547990add2d3fe9c82172307af8c18a4f193b84d19147d2ef09e819ccada2
7
- data.tar.gz: 6e574c34b7ef92618eb2daead194a470256fd58a82307fbc3f50b3b98b30ba0f73e97c9f54c62bb19a251dbeda9fd1956bd5866d05abef7925d55dfa040ecb58
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.respond_to?(:id) ? category.id : category) }
18
- scope :descendant_category_is, ->(category) { where descendant_category_id: (category.respond_to?(:id) ? 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
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Category
3
- VERSION = '1.6.4'.freeze
3
+ VERSION = '1.6.5'.freeze
4
4
  end
5
5
  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
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-15 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common