ltree_hierarchy 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d5c26309b9170981b2ed394e7810e2160c19f4aa
4
- data.tar.gz: fe39b129c2da491c88aa665d47a73f3743ea00c7
2
+ SHA256:
3
+ metadata.gz: a524de2818a42507d93948ce8ace56e9d765a7ff65d6e65b7232b12164dd8263
4
+ data.tar.gz: b8dcd7a002ba01cf2a1be14ce5725c52d3939b3c88837f3bb03e0e22413839d6
5
5
  SHA512:
6
- metadata.gz: 6257d1cf2fa25878fd43941ba1ce3716c248ad71b2a8bddfdf4d174e9750bd33ea9683a5e26cf8520816dfd001e7e4f4cb79191c0cb782f5232f785c01e951bf
7
- data.tar.gz: 39e117fcd55f69f7f65bb5b582fe64200e10565659e1c8dc62547c14f0e3ded48b687b13bbacfb7180bc489b44854ec825ecfa4873f97b7ac353d194bb71f400
6
+ metadata.gz: 51f9e96a6bd07c8876374d4df354cb81a723699ee1e662c8ed9e16a1c530494d09922eb958d979e16894e0a42e3800ab4eaa654bed84eadf02f4c627c0b61e48
7
+ data.tar.gz: 96cccdf94819ab783dbd9ad6aa5c5f0bdecbc2b83bcd147c4d3079e957293a9db52f8ab888dbaf90c3b6d88fdf3cc460ecb3aacc0f332aa880285525059c439d
@@ -1,35 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ltree_hierarchy (0.0.8)
5
- activerecord (>= 3.1.0)
4
+ ltree_hierarchy (1.0.0)
5
+ activerecord (>= 4.2.0)
6
6
  pg
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.2.7.1)
12
- activesupport (= 4.2.7.1)
13
- builder (~> 3.1)
14
- activerecord (4.2.7.1)
15
- activemodel (= 4.2.7.1)
16
- activesupport (= 4.2.7.1)
17
- arel (~> 6.0)
18
- activesupport (4.2.7.1)
19
- i18n (~> 0.7)
20
- json (~> 1.7, >= 1.7.7)
11
+ activemodel (5.2.2)
12
+ activesupport (= 5.2.2)
13
+ activerecord (5.2.2)
14
+ activemodel (= 5.2.2)
15
+ activesupport (= 5.2.2)
16
+ arel (>= 9.0)
17
+ activesupport (5.2.2)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 0.7, < 2)
21
20
  minitest (~> 5.1)
22
- thread_safe (~> 0.3, >= 0.3.4)
23
21
  tzinfo (~> 1.1)
24
- arel (6.0.3)
25
- builder (3.2.2)
26
- i18n (0.7.0)
27
- json (1.8.3)
28
- minitest (5.9.1)
29
- pg (0.19.0)
30
- rake (11.3.0)
31
- thread_safe (0.3.5)
32
- tzinfo (1.2.2)
22
+ arel (9.0.0)
23
+ concurrent-ruby (1.1.4)
24
+ i18n (1.5.3)
25
+ concurrent-ruby (~> 1.0)
26
+ minitest (5.11.3)
27
+ pg (1.1.4)
28
+ rake (12.3.2)
29
+ thread_safe (0.3.6)
30
+ tzinfo (1.2.5)
33
31
  thread_safe (~> 0.1)
34
32
 
35
33
  PLATFORMS
@@ -41,4 +39,4 @@ DEPENDENCIES
41
39
  rake
42
40
 
43
41
  BUNDLED WITH
44
- 1.13.6
42
+ 1.16.3
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/ltree_hierarchy.svg)](https://badge.fury.io/rb/ltree_hierarchy)
1
2
  [![Build Status](https://travis-ci.org/cfabianski/ltree_hierarchy.svg?branch=master)](https://travis-ci.org/cfabianski/ltree_hierarchy)
2
3
 
3
4
  # Ltree Hierarchy
@@ -4,10 +4,11 @@ module Ltree
4
4
  options = {
5
5
  fragment: :id,
6
6
  parent_fragment: :parent_id,
7
- path: :path
7
+ path: :path,
8
+ optional: true
8
9
  }.merge(options)
9
10
 
10
- options.assert_valid_keys(:fragment, :parent_fragment, :path)
11
+ options.assert_valid_keys(:fragment, :parent_fragment, :path, :optional)
11
12
 
12
13
  cattr_accessor :ltree_fragment_column, :ltree_parent_fragment_column, :ltree_path_column
13
14
 
@@ -15,8 +16,14 @@ module Ltree
15
16
  self.ltree_parent_fragment_column = options[:parent_fragment]
16
17
  self.ltree_path_column = options[:path]
17
18
 
18
- belongs_to :parent, class_name: name, foreign_key: ltree_parent_fragment_column
19
+ belongs_to_parent_opts = {
20
+ class_name: name,
21
+ foreign_key: ltree_parent_fragment_column,
22
+ primary_key: ltree_fragment_column,
23
+ optional: true
24
+ }
19
25
 
26
+ belongs_to :parent, belongs_to_parent_opts
20
27
  validate :prevent_circular_paths, if: :ltree_parent_fragment_changed?
21
28
 
22
29
  after_create :commit_path
@@ -1,5 +1,5 @@
1
1
  module Ltree
2
2
  module Hierarchy
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ltree_hierarchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Worley
@@ -9,36 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-11 00:00:00.000000000 Z
12
+ date: 2019-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 1.1.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: 1.1.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 4.2.0
34
+ version: 5.2.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 4.2.0
41
+ version: 5.2.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -104,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubyforge_project: ltree_hierarchy
108
- rubygems_version: 2.5.2
107
+ rubyforge_project:
108
+ rubygems_version: 2.7.9
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Organize ActiveRecord models into a tree using PostgreSQL's ltree datatype