Class: PgGraph::Data::LinkAssociation
- Inherits:
-
Association
- Object
- Association
- PgGraph::Data::LinkAssociation
- Defined in:
- lib/pg_graph/data/association.rb
Instance Attribute Summary collapse
-
#that_association ⇒ Object
readonly
From the link table to ‘that’ table.
-
#this_association ⇒ Object
readonly
From this table to the link table.
Attributes inherited from Association
#dimension, #that_field, #that_table, #this_field, #this_table
Instance Method Summary collapse
-
#get_records(record) ⇒ Object
Note that records are not unique for MmTableAssociation but for NmTableAssociation objects.
-
#initialize(dimension, this_table, that_table, link_table, this_field, this_link_field, that_link_field, that_field) ⇒ LinkAssociation
constructor
A new instance of LinkAssociation.
-
#link_table ⇒ Object
The link table in the N:M relation.
-
#that_link_field ⇒ Object
The field in the link table that links to that record.
-
#this_link_field ⇒ Object
The field in the link table that links to this record.
Methods inherited from Association
Constructor Details
#initialize(dimension, this_table, that_table, link_table, this_field, this_link_field, that_link_field, that_field) ⇒ LinkAssociation
Returns a new instance of LinkAssociation.
66 67 68 69 70 71 72 73 |
# File 'lib/pg_graph/data/association.rb', line 66 def initialize( dimension, this_table, that_table, link_table, this_field, this_link_field, that_link_field, that_field) super(dimension, this_table, that_table, this_field, that_field) @this_association = Association.new(2, this_table, link_table, this_field, this_link_field) @that_association = Association.new(1, link_table, that_table, that_link_field, that_field) end |
Instance Attribute Details
#that_association ⇒ Object (readonly)
From the link table to ‘that’ table. RecordAssociation object
55 56 57 |
# File 'lib/pg_graph/data/association.rb', line 55 def that_association @that_association end |
#this_association ⇒ Object (readonly)
From this table to the link table. TableAssociation object
52 53 54 |
# File 'lib/pg_graph/data/association.rb', line 52 def this_association @this_association end |
Instance Method Details
#get_records(record) ⇒ Object
Note that records are not unique for MmTableAssociation but for NmTableAssociation objects
77 78 79 |
# File 'lib/pg_graph/data/association.rb', line 77 def get_records(record) @this_association.get(record).map { |link_record| @that_association.get(link_record) } end |
#link_table ⇒ Object
The link table in the N:M relation
58 |
# File 'lib/pg_graph/data/association.rb', line 58 def link_table() this_association.that_table end |
#that_link_field ⇒ Object
The field in the link table that links to that record
64 |
# File 'lib/pg_graph/data/association.rb', line 64 def that_link_field() that_association.this_field end |
#this_link_field ⇒ Object
The field in the link table that links to this record
61 |
# File 'lib/pg_graph/data/association.rb', line 61 def this_link_field() this_association.that_field end |