activeitem 0.0.16 → 0.0.17
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 +4 -4
- data/lib/active_item/associations.rb +5 -1
- data/lib/active_item/relation.rb +5 -10
- data/lib/active_item/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a4b1c7cc7af49e67776f895886bdf472d1e801ab3280f3ea28101bd20b8a701
|
|
4
|
+
data.tar.gz: 7415931df8a26b187e4a9ab52586b67c7cea08f0fa3a476ab09b863c02250835
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8c97c1ffadb921d440702b5299cf4bb219ba97ad0351cef7bebfea1125e74bf027ddc0546e1a254da8d6da8952598bf170368404c6ab65074ecc8379bfaec3b
|
|
7
|
+
data.tar.gz: b9936169d15857e1423de8f622ddfe85b7be05458739f569ce1983dd6565f234ae2789f12978ac530106cc98203906a99b9666805d1e2e43c7e0a275e7c41d06
|
|
@@ -143,9 +143,13 @@ module ActiveItem
|
|
|
143
143
|
"#{association_name.to_s.camelize}Index"
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
+
# Store partition key in DynamoDB format (camelCase) for consistency
|
|
147
|
+
# with RECENT_INDEX and explicit index definitions
|
|
148
|
+
dynamo_key = to_dynamo_key(foreign_key)
|
|
149
|
+
|
|
146
150
|
@_belongs_to_indexes ||= {}
|
|
147
151
|
@_belongs_to_indexes = @_belongs_to_indexes.merge(
|
|
148
|
-
index_name => { partition_key:
|
|
152
|
+
index_name => { partition_key: dynamo_key }
|
|
149
153
|
)
|
|
150
154
|
end
|
|
151
155
|
end
|
data/lib/active_item/relation.rb
CHANGED
|
@@ -547,8 +547,7 @@ module ActiveItem
|
|
|
547
547
|
if effective_index && normalized_conditions.any? && normalized_conditions.values.first.is_a?(Array)
|
|
548
548
|
index_config = resolved_model.indexes[effective_index] || {}
|
|
549
549
|
ruby_partition_key = normalized_conditions.keys.first.to_s
|
|
550
|
-
|
|
551
|
-
dynamo_partition_key = resolved_model.to_dynamo_key(raw_pk)
|
|
550
|
+
dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
|
|
552
551
|
return fanout_paginated_query(effective_index, normalized_conditions, index_config, dynamo_partition_key,
|
|
553
552
|
normalized_conditions.values.first, cursor, per_page)
|
|
554
553
|
end
|
|
@@ -613,8 +612,7 @@ module ActiveItem
|
|
|
613
612
|
partition_value = normalized_conditions.values.first
|
|
614
613
|
|
|
615
614
|
index_config = resolved_model.indexes[idx_name] || {}
|
|
616
|
-
|
|
617
|
-
dynamo_partition_key = resolved_model.to_dynamo_key(raw_pk)
|
|
615
|
+
dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
|
|
618
616
|
|
|
619
617
|
params = {
|
|
620
618
|
table_name: resolved_model.table_name,
|
|
@@ -863,8 +861,7 @@ module ActiveItem
|
|
|
863
861
|
partition_value = normalized_conditions.values.first
|
|
864
862
|
|
|
865
863
|
index_config = resolved_model.indexes[idx_name] || {}
|
|
866
|
-
|
|
867
|
-
dynamo_partition_key = resolved_model.to_dynamo_key(raw_partition_key)
|
|
864
|
+
dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
|
|
868
865
|
|
|
869
866
|
params = {
|
|
870
867
|
table_name: resolved_model.table_name,
|
|
@@ -980,8 +977,7 @@ module ActiveItem
|
|
|
980
977
|
partition_value = normalized_conditions.values.first
|
|
981
978
|
|
|
982
979
|
index_config = resolved_model.indexes[idx_name] || {}
|
|
983
|
-
|
|
984
|
-
dynamo_partition_key = resolved_model.to_dynamo_key(raw_pk)
|
|
980
|
+
dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
|
|
985
981
|
|
|
986
982
|
params = {
|
|
987
983
|
table_name: resolved_model.table_name,
|
|
@@ -1139,9 +1135,8 @@ module ActiveItem
|
|
|
1139
1135
|
# Get the actual DynamoDB partition key name from the index definition
|
|
1140
1136
|
# The index definition stores the DynamoDB key name (which may be camelCase)
|
|
1141
1137
|
index_config = resolved_model.indexes[idx_name] || {}
|
|
1142
|
-
raw_partition_key = index_config[:partition_key]&.to_s || ruby_partition_key
|
|
1143
1138
|
# Always convert to DynamoDB key format (camelCase) for the expression
|
|
1144
|
-
dynamo_partition_key = resolved_model.to_dynamo_key(
|
|
1139
|
+
dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
|
|
1145
1140
|
|
|
1146
1141
|
return fanout_query(idx_name, normalized_conditions, index_config, dynamo_partition_key, partition_value) if partition_value.is_a?(Array)
|
|
1147
1142
|
|
data/lib/active_item/version.rb
CHANGED