lib/active_graph/relationship.rb in activegraph-11.5.0.beta.3 vs lib/active_graph/relationship.rb in activegraph-12.0.0.beta.1
- old
+ new
@@ -8,10 +8,11 @@
include ActiveGraph::Shared
include ActiveGraph::Relationship::Initialize
include ActiveGraph::Shared::Identity
include ActiveGraph::Shared::Marshal
+ include ActiveGraph::Node::IdProperty
include ActiveGraph::Shared::SerializedProperties
include ActiveGraph::Relationship::Property
include ActiveGraph::Relationship::Persistence
include ActiveGraph::Relationship::Validations
include ActiveGraph::Relationship::Callbacks
@@ -22,10 +23,12 @@
include ActiveGraph::Transactions
class FrozenRelError < ActiveGraph::Error; end
def initialize(from_node = nil, to_node = nil, args = nil)
+ self.class.ensure_id_property_info! # So that we make sure all objects have an id_property
+
load_nodes(node_or_nil(from_node), node_or_nil(to_node))
resolved_args = hash_or_nil(from_node, args)
symbol_args = sanitize_input_parameters(resolved_args)
super(symbol_args)
end
@@ -56,10 +59,10 @@
ActiveSupport.run_load_hooks(:relationship, self)
private
def node_or_nil(node)
- node.is_a?(ActiveGraph::Node) || node.is_a?(Integer) ? node : nil
+ node.is_a?(ActiveGraph::Node) || node.is_a?(String) ? node : nil
end
def hash_or_nil(node_or_hash, hash_or_nil)
hash_or_parameter?(node_or_hash) ? node_or_hash : hash_or_nil
end