ltree_hierarchy 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +21 -23
- data/README.md +1 -0
- data/lib/ltree_hierarchy/hierarchy.rb +10 -3
- data/lib/ltree_hierarchy/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a524de2818a42507d93948ce8ace56e9d765a7ff65d6e65b7232b12164dd8263
|
4
|
+
data.tar.gz: b8dcd7a002ba01cf2a1be14ce5725c52d3939b3c88837f3bb03e0e22413839d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51f9e96a6bd07c8876374d4df354cb81a723699ee1e662c8ed9e16a1c530494d09922eb958d979e16894e0a42e3800ab4eaa654bed84eadf02f4c627c0b61e48
|
7
|
+
data.tar.gz: 96cccdf94819ab783dbd9ad6aa5c5f0bdecbc2b83bcd147c4d3079e957293a9db52f8ab888dbaf90c3b6d88fdf3cc460ecb3aacc0f332aa880285525059c439d
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ltree_hierarchy (0.0
|
5
|
-
activerecord (>=
|
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 (
|
12
|
-
activesupport (=
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
i18n (
|
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 (
|
25
|
-
|
26
|
-
i18n (
|
27
|
-
|
28
|
-
minitest (5.
|
29
|
-
pg (
|
30
|
-
rake (
|
31
|
-
thread_safe (0.3.
|
32
|
-
tzinfo (1.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.
|
42
|
+
1.16.3
|
data/README.md
CHANGED
@@ -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
|
-
|
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
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
108
|
-
rubygems_version: 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
|