polyamorous 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/polyamorous.rb +2 -7
- data/lib/polyamorous/{activerecord_5.2.1_ruby_2 → activerecord_5.2_ruby_2}/join_association.rb +0 -2
- data/lib/polyamorous/{activerecord_5.2.1_ruby_2 → activerecord_5.2_ruby_2}/join_dependency.rb +0 -2
- data/lib/polyamorous/{activerecord_5.2.0_ruby_2 → activerecord_5.2_ruby_2}/reflection.rb +0 -0
- data/lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb +1 -1
- data/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb +1 -1
- data/lib/polyamorous/version.rb +1 -1
- data/polyamorous.gemspec +1 -9
- metadata +7 -70
- data/lib/polyamorous/activerecord_5.0_ruby_2/join_association.rb +0 -2
- data/lib/polyamorous/activerecord_5.0_ruby_2/join_dependency.rb +0 -2
- data/lib/polyamorous/activerecord_5.1_ruby_2/join_association.rb +0 -31
- data/lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb +0 -112
- data/lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb +0 -31
- data/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb +0 -112
- data/lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4828e729dad541eaab8ae5ec3274171f8b3af19c9280880e5b34ddfe6df62a52
|
4
|
+
data.tar.gz: 68b0698ce59b4a487b6b633d958714d6418422e3a7a4cbbf6c09e5d81aae7d34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edfcad3c9bdbe53d68e203efac4dba201f06084fb22b962fc0f2ac2350b1a7af56a4d5dc05ca330689ab31e1581acdf77f186c7b28625f2a3a3e6f6137f4b68d
|
7
|
+
data.tar.gz: 66eacd475f4907bc8183522d4c3ed6617941cec8898d2fac2f4ac2f9a0953cf66f8e8183eb6db0fce7b0302bc75c9e204bba3c7e8ce9bcb669841a08f739695e
|
data/lib/polyamorous.rb
CHANGED
@@ -12,16 +12,11 @@ if defined?(::ActiveRecord)
|
|
12
12
|
require 'polyamorous/swapping_reflection_class'
|
13
13
|
|
14
14
|
ar_version = ::ActiveRecord::VERSION::STRING[0,3]
|
15
|
-
|
16
|
-
ar_version = "5.2.1" if ::ActiveRecord::VERSION::STRING >= "5.2.1" && ::ActiveRecord.version < ::Gem::Version.new("6.0")
|
17
|
-
%w(join_association join_dependency).each do |file|
|
15
|
+
%w(join_association join_dependency reflection).each do |file|
|
18
16
|
require "polyamorous/activerecord_#{ar_version}_ruby_2/#{file}"
|
19
17
|
end
|
20
18
|
|
21
|
-
|
22
|
-
require "polyamorous/activerecord_#{ar_version}_ruby_2/reflection.rb"
|
23
|
-
::ActiveRecord::Reflection::AbstractReflection.send(:prepend, Polyamorous::ReflectionExtensions)
|
24
|
-
end
|
19
|
+
ActiveRecord::Reflection::AbstractReflection.send(:prepend, Polyamorous::ReflectionExtensions)
|
25
20
|
|
26
21
|
Polyamorous::JoinDependency.send(:prepend, Polyamorous::JoinDependencyExtensions)
|
27
22
|
Polyamorous::JoinDependency.singleton_class.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods)
|
File without changes
|
@@ -1,2 +1,2 @@
|
|
1
1
|
# active_record_6.0_ruby_2/join_association
|
2
|
-
require 'polyamorous/activerecord_5.
|
2
|
+
require 'polyamorous/activerecord_5.2_ruby_2/join_association'
|
@@ -1,2 +1,2 @@
|
|
1
1
|
# active_record_6.0_ruby_2/reflection.rb
|
2
|
-
require 'polyamorous/activerecord_5.
|
2
|
+
require 'polyamorous/activerecord_5.2_ruby_2/reflection'
|
data/lib/polyamorous/version.rb
CHANGED
data/polyamorous.gemspec
CHANGED
@@ -18,18 +18,10 @@ Gem::Specification.new do |s|
|
|
18
18
|
associations.
|
19
19
|
}
|
20
20
|
|
21
|
-
s.add_dependency 'activerecord', '>= 5.
|
22
|
-
s.add_development_dependency 'rspec', '~> 3'
|
23
|
-
s.add_development_dependency 'machinist', '~> 1.0.6'
|
24
|
-
s.add_development_dependency 'faker', '~> 1.6.5'
|
25
|
-
s.add_development_dependency 'sqlite3', '~> 1.3.3'
|
21
|
+
s.add_dependency 'activerecord', '>= 5.2.1'
|
26
22
|
|
27
23
|
s.files = `git ls-files`.split("\n")
|
28
24
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
30
26
|
s.require_paths = ["lib"]
|
31
|
-
|
32
|
-
# specify any dependencies here; for example:
|
33
|
-
# s.add_development_dependency "rspec"
|
34
|
-
# s.add_runtime_dependency "rest-client"
|
35
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyamorous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Miller
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-01-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activerecord
|
@@ -19,70 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 5.2.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rspec
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
requirements:
|
34
|
-
- - "~>"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '3'
|
37
|
-
type: :development
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - "~>"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '3'
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: machinist
|
46
|
-
requirement: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - "~>"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 1.0.6
|
51
|
-
type: :development
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 1.0.6
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: faker
|
60
|
-
requirement: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - "~>"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 1.6.5
|
65
|
-
type: :development
|
66
|
-
prerelease: false
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 1.6.5
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: sqlite3
|
74
|
-
requirement: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - "~>"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 1.3.3
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - "~>"
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 1.3.3
|
29
|
+
version: 5.2.1
|
86
30
|
description: "\n This is just an extraction from Ransack/Squeel. You probably don't
|
87
31
|
want to use this\n directly. It extends ActiveRecord's associations to support
|
88
32
|
polymorphic belongs_to\n associations.\n "
|
@@ -96,16 +40,9 @@ extensions: []
|
|
96
40
|
extra_rdoc_files: []
|
97
41
|
files:
|
98
42
|
- lib/polyamorous.rb
|
99
|
-
- lib/polyamorous/activerecord_5.
|
100
|
-
- lib/polyamorous/activerecord_5.
|
101
|
-
- lib/polyamorous/activerecord_5.
|
102
|
-
- lib/polyamorous/activerecord_5.1_ruby_2/join_dependency.rb
|
103
|
-
- lib/polyamorous/activerecord_5.2.0_ruby_2/join_association.rb
|
104
|
-
- lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb
|
105
|
-
- lib/polyamorous/activerecord_5.2.0_ruby_2/reflection.rb
|
106
|
-
- lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb
|
107
|
-
- lib/polyamorous/activerecord_5.2.1_ruby_2/join_dependency.rb
|
108
|
-
- lib/polyamorous/activerecord_5.2.1_ruby_2/reflection.rb
|
43
|
+
- lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb
|
44
|
+
- lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb
|
45
|
+
- lib/polyamorous/activerecord_5.2_ruby_2/reflection.rb
|
109
46
|
- lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
|
110
47
|
- lib/polyamorous/activerecord_6.0_ruby_2/join_dependency.rb
|
111
48
|
- lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# active_record_5.1_ruby_2/join_association.rb
|
2
|
-
|
3
|
-
module Polyamorous
|
4
|
-
module JoinAssociationExtensions
|
5
|
-
include SwappingReflectionClass
|
6
|
-
def self.prepended(base)
|
7
|
-
base.class_eval { attr_reader :join_type }
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
|
11
|
-
@join_type = join_type
|
12
|
-
if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
|
13
|
-
swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
|
14
|
-
super(reflection, children)
|
15
|
-
self.reflection.options[:polymorphic] = true
|
16
|
-
end
|
17
|
-
else
|
18
|
-
super(reflection, children)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def build_constraint(klass, table, key, foreign_table, foreign_key)
|
23
|
-
if reflection.polymorphic?
|
24
|
-
super(klass, table, key, foreign_table, foreign_key)
|
25
|
-
.and(foreign_table[reflection.foreign_type].eq(reflection.klass.name))
|
26
|
-
else
|
27
|
-
super(klass, table, key, foreign_table, foreign_key)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# active_record_5.1_ruby_2/join_dependency.rb
|
2
|
-
|
3
|
-
module Polyamorous
|
4
|
-
module JoinDependencyExtensions
|
5
|
-
# Replaces ActiveRecord::Associations::JoinDependency#build
|
6
|
-
#
|
7
|
-
def build(associations, base_klass)
|
8
|
-
associations.map do |name, right|
|
9
|
-
if name.is_a? Join
|
10
|
-
reflection = find_reflection base_klass, name.name
|
11
|
-
reflection.check_validity!
|
12
|
-
reflection.check_eager_loadable!
|
13
|
-
|
14
|
-
klass = if reflection.polymorphic?
|
15
|
-
name.klass || base_klass
|
16
|
-
else
|
17
|
-
reflection.klass
|
18
|
-
end
|
19
|
-
JoinAssociation.new(reflection, build(right, klass), name.klass, name.type)
|
20
|
-
else
|
21
|
-
reflection = find_reflection base_klass, name
|
22
|
-
reflection.check_validity!
|
23
|
-
reflection.check_eager_loadable!
|
24
|
-
|
25
|
-
if reflection.polymorphic?
|
26
|
-
raise ActiveRecord::EagerLoadPolymorphicError.new(reflection)
|
27
|
-
end
|
28
|
-
JoinAssociation.new reflection, build(right, reflection.klass)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Replaces ActiveRecord::Associations::JoinDependency#join_constraints
|
34
|
-
#
|
35
|
-
# This internal method was changed in Rails 5.0 by commit
|
36
|
-
# https://github.com/rails/rails/commit/e038975 which added
|
37
|
-
# left_outer_joins (see #make_polyamorous_left_outer_joins below) and added
|
38
|
-
# passing an additional argument, `join_type`, to #join_constraints.
|
39
|
-
#
|
40
|
-
def join_constraints(outer_joins, join_type)
|
41
|
-
joins = join_root.children.flat_map { |child|
|
42
|
-
if join_type == Arel::Nodes::OuterJoin
|
43
|
-
make_polyamorous_left_outer_joins join_root, child
|
44
|
-
else
|
45
|
-
make_polyamorous_inner_joins join_root, child
|
46
|
-
end
|
47
|
-
}
|
48
|
-
|
49
|
-
joins.concat outer_joins.flat_map { |oj|
|
50
|
-
if join_root.match? oj.join_root
|
51
|
-
walk(join_root, oj.join_root)
|
52
|
-
else
|
53
|
-
oj.join_root.children.flat_map { |child|
|
54
|
-
make_outer_joins(oj.join_root, child)
|
55
|
-
}
|
56
|
-
end
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
# Replaces ActiveRecord::Associations::JoinDependency#make_left_outer_joins,
|
61
|
-
# a new method that was added in Rails 5.0 with the following commit:
|
62
|
-
# https://github.com/rails/rails/commit/e038975
|
63
|
-
#
|
64
|
-
def make_polyamorous_left_outer_joins(parent, child)
|
65
|
-
tables = child.tables
|
66
|
-
join_type = Arel::Nodes::OuterJoin
|
67
|
-
info = make_constraints parent, child, tables, join_type
|
68
|
-
|
69
|
-
[info] + child.children.flat_map { |c|
|
70
|
-
make_polyamorous_left_outer_joins(child, c)
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
# Replaces ActiveRecord::Associations::JoinDependency#make_inner_joins
|
75
|
-
#
|
76
|
-
def make_polyamorous_inner_joins(parent, child)
|
77
|
-
tables = child.tables
|
78
|
-
join_type = child.join_type || Arel::Nodes::InnerJoin
|
79
|
-
info = make_constraints parent, child, tables, join_type
|
80
|
-
|
81
|
-
[info] + child.children.flat_map { |c|
|
82
|
-
make_polyamorous_inner_joins(child, c)
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
private :make_polyamorous_inner_joins, :make_polyamorous_left_outer_joins
|
87
|
-
|
88
|
-
module ClassMethods
|
89
|
-
# Prepended before ActiveRecord::Associations::JoinDependency#walk_tree
|
90
|
-
#
|
91
|
-
def walk_tree(associations, hash)
|
92
|
-
case associations
|
93
|
-
when TreeNode
|
94
|
-
associations.add_to_tree(hash)
|
95
|
-
when Hash
|
96
|
-
associations.each do |k, v|
|
97
|
-
cache =
|
98
|
-
if TreeNode === k
|
99
|
-
k.add_to_tree(hash)
|
100
|
-
else
|
101
|
-
hash[k] ||= {}
|
102
|
-
end
|
103
|
-
walk_tree(v, cache)
|
104
|
-
end
|
105
|
-
else
|
106
|
-
super(associations, hash)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# active_record_5.2_ruby_2/join_association.rb
|
2
|
-
|
3
|
-
module Polyamorous
|
4
|
-
module JoinAssociationExtensions
|
5
|
-
include SwappingReflectionClass
|
6
|
-
def self.prepended(base)
|
7
|
-
base.class_eval { attr_reader :join_type }
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize(reflection, children, alias_tracker, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
|
11
|
-
@join_type = join_type
|
12
|
-
if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
|
13
|
-
swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
|
14
|
-
super(reflection, children, alias_tracker)
|
15
|
-
self.reflection.options[:polymorphic] = true
|
16
|
-
end
|
17
|
-
else
|
18
|
-
super(reflection, children, alias_tracker)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def build_constraint(klass, table, key, foreign_table, foreign_key)
|
23
|
-
if reflection.polymorphic?
|
24
|
-
super(klass, table, key, foreign_table, foreign_key)
|
25
|
-
.and(foreign_table[reflection.foreign_type].eq(reflection.klass.name))
|
26
|
-
else
|
27
|
-
super(klass, table, key, foreign_table, foreign_key)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# active_record_5.2_ruby_2/join_dependency.rb
|
2
|
-
|
3
|
-
module Polyamorous
|
4
|
-
module JoinDependencyExtensions
|
5
|
-
# Replaces ActiveRecord::Associations::JoinDependency#build
|
6
|
-
#
|
7
|
-
def build(associations, base_klass)
|
8
|
-
associations.map do |name, right|
|
9
|
-
if name.is_a? Join
|
10
|
-
reflection = find_reflection base_klass, name.name
|
11
|
-
reflection.check_validity!
|
12
|
-
reflection.check_eager_loadable!
|
13
|
-
|
14
|
-
klass = if reflection.polymorphic?
|
15
|
-
name.klass || base_klass
|
16
|
-
else
|
17
|
-
reflection.klass
|
18
|
-
end
|
19
|
-
JoinAssociation.new(reflection, build(right, klass), alias_tracker, name.klass, name.type)
|
20
|
-
else
|
21
|
-
reflection = find_reflection base_klass, name
|
22
|
-
reflection.check_validity!
|
23
|
-
reflection.check_eager_loadable!
|
24
|
-
|
25
|
-
if reflection.polymorphic?
|
26
|
-
raise ActiveRecord::EagerLoadPolymorphicError.new(reflection)
|
27
|
-
end
|
28
|
-
JoinAssociation.new(reflection, build(right, reflection.klass), alias_tracker)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Replaces ActiveRecord::Associations::JoinDependency#join_constraints
|
34
|
-
#
|
35
|
-
# This internal method was changed in Rails 5.0 by commit
|
36
|
-
# https://github.com/rails/rails/commit/e038975 which added
|
37
|
-
# left_outer_joins (see #make_polyamorous_left_outer_joins below) and added
|
38
|
-
# passing an additional argument, `join_type`, to #join_constraints.
|
39
|
-
#
|
40
|
-
def join_constraints(outer_joins, join_type)
|
41
|
-
joins = join_root.children.flat_map { |child|
|
42
|
-
if join_type == Arel::Nodes::OuterJoin
|
43
|
-
make_polyamorous_left_outer_joins join_root, child
|
44
|
-
else
|
45
|
-
make_polyamorous_inner_joins join_root, child
|
46
|
-
end
|
47
|
-
}
|
48
|
-
|
49
|
-
joins.concat outer_joins.flat_map { |oj|
|
50
|
-
if join_root.match?(oj.join_root) && join_root.table.name == oj.join_root.table.name
|
51
|
-
walk(join_root, oj.join_root)
|
52
|
-
else
|
53
|
-
oj.join_root.children.flat_map { |child|
|
54
|
-
make_outer_joins(oj.join_root, child)
|
55
|
-
}
|
56
|
-
end
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
# Replaces ActiveRecord::Associations::JoinDependency#make_left_outer_joins,
|
61
|
-
# a new method that was added in Rails 5.0 with the following commit:
|
62
|
-
# https://github.com/rails/rails/commit/e038975
|
63
|
-
#
|
64
|
-
def make_polyamorous_left_outer_joins(parent, child)
|
65
|
-
tables = child.tables
|
66
|
-
join_type = Arel::Nodes::OuterJoin
|
67
|
-
info = make_constraints parent, child, tables, join_type
|
68
|
-
|
69
|
-
info + child.children.flat_map { |c|
|
70
|
-
make_polyamorous_left_outer_joins(child, c)
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
# Replaces ActiveRecord::Associations::JoinDependency#make_inner_joins
|
75
|
-
#
|
76
|
-
def make_polyamorous_inner_joins(parent, child)
|
77
|
-
tables = child.tables
|
78
|
-
join_type = child.join_type || Arel::Nodes::InnerJoin
|
79
|
-
info = make_constraints parent, child, tables, join_type
|
80
|
-
|
81
|
-
info + child.children.flat_map { |c|
|
82
|
-
make_polyamorous_inner_joins(child, c)
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
private :make_polyamorous_inner_joins, :make_polyamorous_left_outer_joins
|
87
|
-
|
88
|
-
module ClassMethods
|
89
|
-
# Prepended before ActiveRecord::Associations::JoinDependency#walk_tree
|
90
|
-
#
|
91
|
-
def walk_tree(associations, hash)
|
92
|
-
case associations
|
93
|
-
when TreeNode
|
94
|
-
associations.add_to_tree(hash)
|
95
|
-
when Hash
|
96
|
-
associations.each do |k, v|
|
97
|
-
cache =
|
98
|
-
if TreeNode === k
|
99
|
-
k.add_to_tree(hash)
|
100
|
-
else
|
101
|
-
hash[k] ||= {}
|
102
|
-
end
|
103
|
-
walk_tree(v, cache)
|
104
|
-
end
|
105
|
-
else
|
106
|
-
super(associations, hash)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|