Sha256: fe34b6f6f654bbe856aa3908451e0bf5f8dc8bb6b9a858017365ba89efae2a14

Contents?: true

Size: 385 Bytes

Versions: 3

Compression:

Stored size: 385 Bytes

Contents

# This class models a vertex in a directed graph.
class Vertex < ActiveRecord::Base
  has_many :sink_edges, :class_name => 'Edge', :foreign_key => 'source_id'
  has_many :sinks, :through => :sink_edges, :source => :sink

  has_and_belongs_to_many :sources,
    :class_name => 'Vertex', :join_table => 'edges',
    :foreign_key => 'sink_id', :association_foreign_key => 'source_id'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-1.15.2 test/fixtures/vertex.rb
activerecord-1.15.1 test/fixtures/vertex.rb
activerecord-1.15.0 test/fixtures/vertex.rb