Open cheerfulstoic opened 9 years ago
Proposed syntax:
has_many :out, :name, :type, variable: true
has_many :out, :name, :type, variable: {min: 1, max: 5}
Could call as:
object.name.to_a # To get objects at the end
object.name.to_paths # To get the paths
object.name_path # To get path for `has_one`
The QueryProxy#to_paths
could even work in general, perhaps, though we'd need to build one long path as opposed to building each step as a separate part of the MATCH
It would also be cool to find a way to turn this into a hierarchy of objects in an eager-loading fashion with just the one query
Would this work so that you could start from one object and find the path to another object using an association like this one?
Yeah, it should. Associations return QueryProxy
objects (more or less, there's a branch in the works) and QueryProxy
responds to the #match_to
method, so you'd be able to say:
source_object.variable_association_name.match_to(target_object).to_paths