solis 0.119.0 → 0.120.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 +4 -4
- data/lib/solis/model.rb +21 -0
- data/lib/solis/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: 663d9c6ac4bec283d623346be498856494152c103c1f347a48a79cac7bc19662
|
|
4
|
+
data.tar.gz: 65e2d8370f3e4ff4638e00293b522b6c4d927b91fcb95259dcb3e21e11c5ae39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b28a6189d553f6e444ebb33760ae7b29abe6ffc084995ba13c69b482a9fc9d562294f293671955e94111e915472aef7a419a2d4b5a9eb1b623dc15f149f9c9df
|
|
7
|
+
data.tar.gz: 24c7b79c0f720b349ecf85c1832ee4e43f3a63d59ba208ce588faa6bf09ed68c09907f57a118832a8a9441e78fb318d7fd50d329d93956ec47b4be4862380a2c
|
data/lib/solis/model.rb
CHANGED
|
@@ -669,6 +669,15 @@ values ?s {<#{self.graph_id}>}
|
|
|
669
669
|
obj.class.ancestors.include?(Solis::Model)
|
|
670
670
|
end
|
|
671
671
|
|
|
672
|
+
# True when only the entity's id is populated — an id-only stub, e.g. an embedded
|
|
673
|
+
# relation materialised by Query#graph_to_object as Model.new(id:).
|
|
674
|
+
def shallow_stub?(entity)
|
|
675
|
+
return false unless solis_model?(entity)
|
|
676
|
+
entity.class.metadata[:attributes].each_key.none? do |attr|
|
|
677
|
+
attr.to_s != 'id' && !entity.instance_variable_get("@#{attr}").nil?
|
|
678
|
+
end
|
|
679
|
+
end
|
|
680
|
+
|
|
672
681
|
# Helper method to check if an entity is readonly (code table)
|
|
673
682
|
def readonly_entity?(entity, readonly_list = nil)
|
|
674
683
|
readonly_list ||= (Solis::Options.instance.get[:embedded_readonly] || []).map(&:to_s)
|
|
@@ -821,6 +830,18 @@ values ?s {<#{self.graph_id}>}
|
|
|
821
830
|
end
|
|
822
831
|
|
|
823
832
|
def make_graph(graph, hierarchy, id, klass, klass_metadata, resolve_all, known_entities = {}, skip_store_fetch: false)
|
|
833
|
+
# klass may arrive as an id-only stub (embedded relation from Query#graph_to_object,
|
|
834
|
+
# or passed via prefetched_original). Resolve it to the full stored entity once so
|
|
835
|
+
# every attribute is emitted into the graph.
|
|
836
|
+
if !skip_store_fetch && shallow_stub?(klass)
|
|
837
|
+
uuid = id.value.split('/').last
|
|
838
|
+
fetched = klass.query.filter({ filters: { id: [uuid] } }).find_all { |f| f.id == uuid }.first
|
|
839
|
+
unless fetched.nil?
|
|
840
|
+
klass = fetched
|
|
841
|
+
known_entities[uuid] = fetched
|
|
842
|
+
end
|
|
843
|
+
end
|
|
844
|
+
|
|
824
845
|
klass_metadata[:attributes].each do |attribute, metadata|
|
|
825
846
|
data = klass.instance_variable_get("@#{attribute}")
|
|
826
847
|
|
data/lib/solis/version.rb
CHANGED