composite_primary_keys 8.1.8 → 9.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/History.rdoc +3 -25
- data/README.rdoc +1 -0
- data/README_DB2.rdoc +33 -33
- data/Rakefile +34 -34
- data/lib/composite_primary_keys.rb +4 -11
- data/lib/composite_primary_keys/associations/association.rb +14 -12
- data/lib/composite_primary_keys/associations/association_scope.rb +27 -54
- data/lib/composite_primary_keys/associations/collection_association.rb +22 -8
- data/lib/composite_primary_keys/associations/has_many_association.rb +16 -54
- data/lib/composite_primary_keys/associations/has_many_through_association.rb +58 -58
- data/lib/composite_primary_keys/associations/join_dependency.rb +74 -56
- data/lib/composite_primary_keys/associations/join_dependency/join_association.rb +13 -11
- data/lib/composite_primary_keys/associations/preloader/association.rb +75 -72
- data/lib/composite_primary_keys/associations/singular_association.rb +8 -12
- data/lib/composite_primary_keys/attribute_methods.rb +6 -4
- data/lib/composite_primary_keys/attribute_methods/primary_key.rb +13 -11
- data/lib/composite_primary_keys/attribute_methods/read.rb +16 -15
- data/lib/composite_primary_keys/attribute_methods/write.rb +21 -19
- data/lib/composite_primary_keys/attribute_set/builder.rb +13 -11
- data/lib/composite_primary_keys/base.rb +5 -69
- data/lib/composite_primary_keys/composite_arrays.rb +8 -51
- data/lib/composite_primary_keys/composite_predicates.rb +7 -16
- data/lib/composite_primary_keys/connection_adapters/abstract_adapter.rb +10 -10
- data/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb +42 -11
- data/lib/composite_primary_keys/core.rb +46 -45
- data/lib/composite_primary_keys/dirty.rb +19 -19
- data/lib/composite_primary_keys/fixtures.rb +19 -17
- data/lib/composite_primary_keys/locking/optimistic.rb +48 -44
- data/lib/composite_primary_keys/nested_attributes.rb +64 -53
- data/lib/composite_primary_keys/persistence.rb +49 -41
- data/lib/composite_primary_keys/relation.rb +22 -47
- data/lib/composite_primary_keys/relation/batches.rb +33 -30
- data/lib/composite_primary_keys/relation/calculations.rb +3 -7
- data/lib/composite_primary_keys/relation/finder_methods.rb +123 -56
- data/lib/composite_primary_keys/relation/predicate_builder.rb +18 -29
- data/lib/composite_primary_keys/relation/where_clause.rb +33 -0
- data/lib/composite_primary_keys/sanitization.rb +45 -38
- data/lib/composite_primary_keys/validations/uniqueness.rb +37 -37
- data/lib/composite_primary_keys/version.rb +4 -4
- data/scripts/console.rb +48 -48
- data/scripts/txt2html +76 -76
- data/scripts/txt2js +65 -65
- data/tasks/databases/mysql.rake +42 -42
- data/tasks/databases/postgresql.rake +47 -47
- data/tasks/databases/sqlite3.rake +27 -27
- data/tasks/website.rake +18 -18
- data/test/README_tests.rdoc +56 -56
- data/test/abstract_unit.rb +10 -9
- data/test/connections/connection_spec.rb +18 -18
- data/test/connections/databases.yml +9 -39
- data/test/connections/native_ibm_db/connection.rb +18 -18
- data/test/connections/native_mysql/connection.rb +17 -17
- data/test/connections/native_postgresql/connection.rb +12 -12
- data/test/connections/native_sqlite3/connection.rb +9 -9
- data/test/db_test.rb +52 -52
- data/test/fixtures/article.rb +5 -5
- data/test/fixtures/articles.yml +6 -6
- data/test/fixtures/capitol.rb +3 -3
- data/test/fixtures/capitols.yml +16 -16
- data/test/fixtures/comments.yml +15 -15
- data/test/fixtures/db_definitions/mysql.sql +2 -12
- data/test/fixtures/db_definitions/oracle.sql +1 -2
- data/test/fixtures/db_definitions/postgresql.sql +0 -10
- data/test/fixtures/db_definitions/sqlite.sql +0 -9
- data/test/fixtures/db_definitions/sqlserver.sql +1 -2
- data/test/fixtures/department.rb +5 -5
- data/test/fixtures/departments.yml +15 -15
- data/test/fixtures/dorms.yml +4 -4
- data/test/fixtures/employee.rb +1 -2
- data/test/fixtures/employees.yml +19 -23
- data/test/fixtures/group.rb +2 -2
- data/test/fixtures/groups.yml +6 -6
- data/test/fixtures/hack.rb +4 -4
- data/test/fixtures/hacks.yml +2 -2
- data/test/fixtures/membership_status.rb +2 -2
- data/test/fixtures/product.rb +9 -9
- data/test/fixtures/product_tariff.rb +5 -5
- data/test/fixtures/products.yml +11 -11
- data/test/fixtures/reading.rb +4 -4
- data/test/fixtures/readings.yml +10 -10
- data/test/fixtures/reference_code_using_composite_key_alias.rb +8 -8
- data/test/fixtures/reference_code_using_simple_key_alias.rb +8 -8
- data/test/fixtures/reference_codes.yml +28 -28
- data/test/fixtures/reference_type.rb +1 -1
- data/test/fixtures/reference_types.yml +9 -9
- data/test/fixtures/restaurant.rb +9 -9
- data/test/fixtures/restaurants.yml +14 -14
- data/test/fixtures/restaurants_suburbs.yml +10 -10
- data/test/fixtures/room.rb +11 -11
- data/test/fixtures/room_assignment.rb +13 -13
- data/test/fixtures/room_assignments.yml +24 -24
- data/test/fixtures/room_attribute.rb +2 -2
- data/test/fixtures/room_attribute_assignment.rb +4 -4
- data/test/fixtures/room_attribute_assignments.yml +4 -4
- data/test/fixtures/room_attributes.yml +2 -2
- data/test/fixtures/rooms.yml +12 -12
- data/test/fixtures/seat.rb +5 -5
- data/test/fixtures/seats.yml +8 -8
- data/test/fixtures/street.rb +2 -2
- data/test/fixtures/streets.yml +16 -16
- data/test/fixtures/student.rb +3 -3
- data/test/fixtures/students.yml +15 -15
- data/test/fixtures/suburbs.yml +14 -14
- data/test/fixtures/tariff.rb +5 -5
- data/test/fixtures/tariffs.yml +14 -14
- data/test/fixtures/user.rb +0 -1
- data/test/plugins/pagination.rb +405 -405
- data/test/plugins/pagination_helper.rb +135 -135
- data/test/setup.rb +50 -50
- data/test/test_aliases.rb +18 -18
- data/test/test_associations.rb +7 -18
- data/test/test_composite_arrays.rb +24 -38
- data/test/test_counter_cache.rb +30 -30
- data/test/test_create.rb +5 -5
- data/test/test_delete_all.rb +7 -13
- data/test/test_dup.rb +37 -37
- data/test/test_exists.rb +39 -39
- data/test/test_find.rb +16 -12
- data/test/test_habtm.rb +26 -2
- data/test/test_ids.rb +109 -116
- data/test/test_miscellaneous.rb +32 -32
- data/test/test_pagination.rb +35 -35
- data/test/test_polymorphic.rb +0 -7
- data/test/test_predicates.rb +9 -28
- data/test/test_update.rb +3 -5
- data/test/test_validations.rb +13 -13
- metadata +24 -32
- data/lib/composite_primary_keys/arel/visitors/to_sql.rb +0 -36
- data/lib/composite_primary_keys/attribute_methods/dirty.rb +0 -29
- data/lib/composite_primary_keys/autosave_association.rb +0 -67
- data/lib/composite_primary_keys/connection_adapters/abstract_mysql_adapter.rb +0 -23
- data/test/fixtures/pk_called_id.rb +0 -5
- data/test/fixtures/pk_called_ids.yml +0 -11
- data/test/test_find_in_batches.rb +0 -30
- data/test/test_update_all.rb +0 -17
@@ -13,79 +13,79 @@ module ActiveRecord
|
|
13
13
|
cpk_in_predicate(through_association.scope.klass.arel_table, source_reflection.foreign_key, ids)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
silence_warnings do
|
17
|
+
def delete_records(records, method)
|
18
|
+
ensure_not_nested
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
scope.where! cpk_join_through_predicate(*records)
|
25
|
-
else
|
26
|
-
scope.where! construct_join_attributes(*records)
|
27
|
-
end
|
28
|
-
|
29
|
-
case method
|
30
|
-
when :destroy
|
31
|
-
if scope.klass.primary_key
|
32
|
-
count = scope.destroy_all.length
|
20
|
+
scope = through_association.scope
|
21
|
+
# CPK
|
22
|
+
# scope.where! construct_join_attributes(*records)
|
23
|
+
if source_reflection.klass.composite?
|
24
|
+
scope.where! cpk_join_through_predicate(*records)
|
33
25
|
else
|
34
|
-
scope.
|
35
|
-
|
36
|
-
end
|
26
|
+
scope.where! construct_join_attributes(*records)
|
27
|
+
end
|
37
28
|
|
38
|
-
|
29
|
+
case method
|
30
|
+
when :destroy
|
31
|
+
if scope.klass.primary_key
|
32
|
+
count = scope.destroy_all.length
|
33
|
+
else
|
34
|
+
scope.to_a.each do |record|
|
35
|
+
record.run_callbacks :destroy
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
stmt.from scope.klass.arel_table
|
42
|
-
stmt.wheres = arel.constraints
|
38
|
+
arel = scope.arel
|
43
39
|
|
44
|
-
|
40
|
+
stmt = Arel::DeleteManager.new arel.engine
|
41
|
+
stmt.from scope.klass.arel_table
|
42
|
+
stmt.wheres = arel.constraints
|
43
|
+
|
44
|
+
count = scope.klass.connection.delete(stmt, 'SQL', scope.bind_values)
|
45
|
+
end
|
46
|
+
when :nullify
|
47
|
+
count = scope.update_all(source_reflection.foreign_key => nil)
|
48
|
+
else
|
49
|
+
count = scope.delete_all
|
45
50
|
end
|
46
|
-
when :nullify
|
47
|
-
count = scope.update_all(source_reflection.foreign_key => nil)
|
48
|
-
else
|
49
|
-
count = scope.delete_all
|
50
|
-
end
|
51
51
|
|
52
|
-
|
52
|
+
delete_through_records(records)
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
if source_reflection.options[:counter_cache] && method != :destroy
|
55
|
+
counter = source_reflection.counter_cache_column
|
56
|
+
klass.decrement_counter counter, records.map(&:id)
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
if through_reflection.collection? && update_through_counter?(method)
|
60
|
+
update_counter(-count, through_reflection)
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
update_counter(-count)
|
64
|
+
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
66
|
+
def through_records_for(record)
|
67
|
+
# CPK
|
68
|
+
# attributes = construct_join_attributes(record)
|
69
|
+
# candidates = Array.wrap(through_association.target)
|
70
|
+
# candidates.find_all do |c|
|
71
|
+
# attributes.all? do |key, value|
|
72
|
+
# c.public_send(key) == value
|
73
|
+
# end
|
74
|
+
# end
|
75
|
+
if record.composite?
|
76
|
+
candidates = Array.wrap(through_association.target)
|
77
|
+
candidates.find_all { |c| c.attributes.slice(*source_reflection.association_primary_key) == record.ids_hash }
|
78
|
+
else
|
79
|
+
attributes = construct_join_attributes(record)
|
80
|
+
candidates = Array.wrap(through_association.target)
|
81
|
+
candidates.find_all do |c|
|
82
|
+
attributes.all? do |key, value|
|
83
|
+
c.public_send(key) == value
|
84
|
+
end
|
84
85
|
end
|
85
86
|
end
|
86
87
|
end
|
87
88
|
end
|
88
|
-
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -2,83 +2,101 @@ module ActiveRecord
|
|
2
2
|
module Associations
|
3
3
|
class JoinDependency
|
4
4
|
class Aliases # :nodoc:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
column.
|
10
|
-
|
5
|
+
silence_warnings do
|
6
|
+
def column_alias(node, column)
|
7
|
+
# CPK
|
8
|
+
#@alias_cache[node][column]
|
9
|
+
if column.kind_of?(Array)
|
10
|
+
column.map do |a_column|
|
11
|
+
@alias_cache[node][a_column]
|
12
|
+
end
|
13
|
+
else
|
14
|
+
@alias_cache[node][column]
|
11
15
|
end
|
12
|
-
else
|
13
|
-
@alias_cache[node][column]
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
silence_warnings do
|
21
|
+
def instantiate(result_set, aliases)
|
22
|
+
primary_key = aliases.column_alias(join_root, join_root.primary_key)
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
seen = Hash.new { |i, object_id|
|
25
|
+
i[object_id] = Hash.new { |j, child_class|
|
26
|
+
j[child_class] = {}
|
27
|
+
}
|
24
28
|
}
|
25
|
-
}
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
model_cache = Hash.new { |h,klass| h[klass] = {} }
|
31
|
+
parents = model_cache[join_root]
|
32
|
+
column_aliases = aliases.column_aliases join_root
|
30
33
|
|
31
|
-
|
32
|
-
# CPK
|
33
|
-
primary_id = if primary_key.kind_of?(Array)
|
34
|
-
primary_key.map {|key| row_hash[key]}
|
35
|
-
else
|
36
|
-
row_hash[primary_key]
|
37
|
-
end
|
38
|
-
parent = parents[primary_id] ||= join_root.instantiate(row_hash, column_aliases)
|
39
|
-
construct(parent, join_root, row_hash, result_set, seen, model_cache, aliases)
|
40
|
-
}
|
34
|
+
message_bus = ActiveSupport::Notifications.instrumenter
|
41
35
|
|
42
|
-
|
43
|
-
|
36
|
+
payload = {
|
37
|
+
record_count: result_set.length,
|
38
|
+
class_name: join_root.base_klass.name
|
39
|
+
}
|
40
|
+
|
41
|
+
message_bus.instrument('instantiation.active_record', payload) do
|
42
|
+
result_set.each { |row_hash|
|
43
|
+
# CPK
|
44
|
+
parent_key = if primary_key.kind_of?(Array)
|
45
|
+
primary_key.map {|key| row_hash[key]}
|
46
|
+
else
|
47
|
+
primary_key ? row_hash[primary_key] : row_hash
|
48
|
+
end
|
49
|
+
|
50
|
+
parent = parents[parent_key] ||= join_root.instantiate(row_hash, column_aliases)
|
51
|
+
construct(parent, join_root, row_hash, result_set, seen, model_cache, aliases)
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
parents.values
|
56
|
+
end
|
44
57
|
|
45
|
-
|
46
|
-
|
58
|
+
def construct(ar_parent, parent, row, rs, seen, model_cache, aliases)
|
59
|
+
return if ar_parent.nil?
|
47
60
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if ar_parent.association_cache.key?(node.reflection.name)
|
61
|
+
parent.children.each do |node|
|
62
|
+
if node.reflection.collection?
|
63
|
+
other = ar_parent.association(node.reflection.name)
|
64
|
+
other.loaded!
|
65
|
+
elsif ar_parent.association_cached?(node.reflection.name)
|
54
66
|
model = ar_parent.association(node.reflection.name).target
|
55
67
|
construct(model, node, row, rs, seen, model_cache, aliases)
|
56
68
|
next
|
57
69
|
end
|
58
|
-
end
|
59
70
|
|
60
|
-
|
71
|
+
key = aliases.column_alias(node, node.primary_key)
|
61
72
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
73
|
+
# CPK
|
74
|
+
if key.is_a?(Array)
|
75
|
+
id = Array(key).map do |column_alias|
|
76
|
+
row[column_alias]
|
77
|
+
end
|
78
|
+
# At least the first value in the key has to be set. Should we require all values to be set?
|
79
|
+
id = nil if id.first.nil?
|
80
|
+
else # original
|
81
|
+
id = row[key]
|
82
|
+
end
|
83
|
+
|
84
|
+
if id.nil? # duplicating this so it is clear what remained unchanged from the original
|
85
|
+
nil_association = ar_parent.association(node.reflection.name)
|
86
|
+
nil_association.loaded!
|
87
|
+
next
|
66
88
|
end
|
67
|
-
# At least the first value in the key has to be set. Should we require all values to be set?
|
68
|
-
next if id.first.nil?
|
69
|
-
else
|
70
|
-
id = row[key]
|
71
|
-
next if id.nil?
|
72
|
-
end
|
73
89
|
|
74
|
-
|
90
|
+
model = seen[ar_parent.object_id][node.base_klass][id]
|
75
91
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
92
|
+
if model
|
93
|
+
construct(model, node, row, rs, seen, model_cache, aliases)
|
94
|
+
else
|
95
|
+
model = construct_model(ar_parent, node, row, model_cache, id, aliases)
|
96
|
+
model.readonly!
|
97
|
+
seen[ar_parent.object_id][node.base_klass][id] = model
|
98
|
+
construct(model, node, row, rs, seen, model_cache, aliases)
|
99
|
+
end
|
82
100
|
end
|
83
101
|
end
|
84
102
|
end
|
@@ -2,19 +2,21 @@ module ActiveRecord
|
|
2
2
|
module Associations
|
3
3
|
class JoinDependency
|
4
4
|
class JoinAssociation
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
silence_warnings do
|
6
|
+
def build_constraint(klass, table, key, foreign_table, foreign_key)
|
7
|
+
# CPK
|
8
|
+
# constraint = table[key].eq(foreign_table[foreign_key])
|
9
|
+
constraint = cpk_join_predicate(table, key, foreign_table, foreign_key)
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
if klass.finder_needs_type_condition?
|
12
|
+
constraint = table.create_and([
|
13
|
+
constraint,
|
14
|
+
klass.send(:type_condition, table)
|
15
|
+
])
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
+
constraint
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -2,92 +2,95 @@ module ActiveRecord
|
|
2
2
|
module Associations
|
3
3
|
class Preloader
|
4
4
|
class Association
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
silence_warnings do
|
6
|
+
def query_scope(ids)
|
7
|
+
# CPK
|
8
|
+
# scope.where(association_key.in(ids))
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
if reflection.foreign_key.is_a?(Array)
|
11
|
+
predicate = cpk_in_predicate(table, reflection.foreign_key, ids)
|
12
|
+
scope.where(predicate)
|
13
|
+
else
|
14
|
+
scope.where(association_key_name => ids)
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
18
|
+
def associated_records_by_owner(preloader)
|
19
|
+
owners_map = owners_by_key
|
20
|
+
# CPK
|
21
|
+
# owner_keys = owners_map.keys.compact
|
22
|
+
owner_keys = if reflection.foreign_key.is_a?(Array)
|
23
|
+
owners.map do |owner|
|
24
|
+
Array(owner_key_name).map do |owner_key|
|
25
|
+
owner[owner_key]
|
26
|
+
end
|
27
|
+
end.compact.uniq
|
28
|
+
else
|
29
|
+
owners_map.keys.compact
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
# Each record may have multiple owners, and vice-versa
|
33
|
+
records_by_owner = owners.each_with_object({}) do |owner,h|
|
34
|
+
h[owner] = []
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
if owner_keys.any?
|
38
|
+
# Some databases impose a limit on the number of ids in a list (in Oracle it's 1000)
|
39
|
+
# Make several smaller queries if necessary or make one query if the adapter supports it
|
40
|
+
sliced = owner_keys.each_slice(klass.connection.in_clause_length || owner_keys.size)
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
records = load_slices sliced
|
43
|
+
records.each do |record, owner_key|
|
44
|
+
owners_map[owner_key].each do |owner|
|
45
|
+
records_by_owner[owner] << record
|
46
|
+
end
|
45
47
|
end
|
46
48
|
end
|
47
|
-
end
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
records_by_owner
|
51
|
+
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
def load_slices(slices)
|
54
|
+
@preloaded_records = slices.flat_map { |slice|
|
55
|
+
records_for(slice)
|
56
|
+
}
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
# CPK
|
59
|
+
# @preloaded_records.map { |record|
|
60
|
+
# key = record[association_key_name]
|
61
|
+
# key = key.to_s if key_conversion_required?
|
62
|
+
#
|
63
|
+
# [record, key]
|
64
|
+
# }
|
65
|
+
@preloaded_records.map { |record|
|
66
|
+
key = Array(association_key_name).map do |key_name|
|
67
|
+
record[key_name]
|
68
|
+
end.join(CompositePrimaryKeys::ID_SEP)
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
[record, key]
|
71
|
+
}
|
72
|
+
end
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
def owners_by_key
|
75
|
+
@owners_by_key ||= if key_conversion_required?
|
76
|
+
owners.group_by do |owner|
|
77
|
+
# CPK
|
78
|
+
# owner[owner_key_name].to_s
|
79
|
+
Array(owner_key_name).map do |key_name|
|
80
|
+
owner[key_name]
|
81
|
+
end.join(CompositePrimaryKeys::ID_SEP)
|
82
|
+
end
|
83
|
+
else
|
84
|
+
owners.group_by do |owner|
|
85
|
+
# CPK
|
86
|
+
# owner[owner_key_name]
|
87
|
+
Array(owner_key_name).map do |key_name|
|
88
|
+
owner[key_name]
|
89
|
+
end.join(CompositePrimaryKeys::ID_SEP)
|
90
|
+
end
|
81
91
|
end
|
82
|
-
|
83
|
-
|
84
|
-
# CPK
|
85
|
-
# owner[owner_key_name]
|
86
|
-
Array(owner_key_name).map do |key_name|
|
87
|
-
owner[key_name]
|
88
|
-
end.to_composite_keys.to_s
|
89
|
-
end
|
90
|
-
end
|
92
|
+
|
93
|
+
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
end
|