lib/neo4j/active_node/labels.rb in neo4j-5.2.12 vs lib/neo4j/active_node/labels.rb in neo4j-5.2.13
- old
+ new
@@ -88,11 +88,11 @@
find_by_ids(id.map { |o| map_id.call(o) })
else
find_by_id(map_id.call(id))
end
fail Neo4j::RecordNotFound if result.blank?
- result
+ result.tap { |r| find_callbacks!(r) }
end
# Finds the first record matching the specified conditions. There is no implied ordering so if order matters, you should specify it yourself.
# @param values Hash args of arguments to find
def find_by(values)
@@ -244,9 +244,20 @@
self.mapped_label_name = name
end
# rubocop:enable Style/AccessorMethodName
private
+
+ def find_callbacks!(result)
+ case result
+ when Neo4j::ActiveNode
+ result.run_callbacks(:find)
+ when Array
+ result.each { |r| find_callbacks!(r) }
+ else
+ result
+ end
+ end
def label_for_model
(self.name.nil? ? object_id.to_s.to_sym : decorated_label_name)
end