Module: Dagnabit::Vertex::Associations
- Includes:
- Settings
- Defined in:
- lib/dagnabit/vertex/associations.rb
Overview
Associates a vertex with its edges.
Instance Attribute Summary
Attributes included from Settings
Instance Method Summary collapse
-
#connected_by(*args) ⇒ void
An override of Settings#connected_by that installs
has_manyassociations namedin_edgesandout_edgeson a vertex model.
Methods included from Settings
#edge_model, #edge_table, #inherited
Instance Method Details
#connected_by(*args) ⇒ void
This method returns an undefined value.
An override of Settings#connected_by that installs has_many
associations named in_edges and out_edges on a vertex model.
in_edges is the collection of edges that flow into a vertex;
out_edges is the collection of edges that flow out of a vertex.
17 18 19 20 21 22 |
# File 'lib/dagnabit/vertex/associations.rb', line 17 def connected_by(*args) super has_many :in_edges, :class_name => edge_model_name, :foreign_key => 'child_id', :dependent => :destroy has_many :out_edges, :class_name => edge_model_name, :foreign_key => 'parent_id', :dependent => :destroy end |