Class: ActiveFacts::Metamodel::AccessPath

Inherits:
Object
  • Object
show all
Defined in:
lib/activefacts/metamodel/metamodel.rb,
lib/activefacts/metamodel/extensions.rb

Direct Known Subclasses

ForeignKey, Index

Instance Method Summary collapse

Instance Method Details

#position_in_index(component) ⇒ Object



1727
1728
1729
# File 'lib/activefacts/metamodel/extensions.rb', line 1727

def position_in_index component
  all_index_field.sort_by(&:ordinal).map(&:component).index(component)
end

#show_traceObject



1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
# File 'lib/activefacts/metamodel/extensions.rb', line 1711

def show_trace
  trace :composition, inspect do
    if is_a?(ForeignKey)
      # First list any fields in a foreign key
      all_foreign_key_field.sort_by(&:ordinal).each do |fkf|
        $stderr.puts "Internal error: Foreign key field to #{fkf.component.column_name} is in #{fkf.component.root.mapping.name} not #{source_composite.mapping.name}!" if fkf.component.root != source_composite
        trace :composition, fkf.inspect
      end
    end
    # Now list the fields in the primary key
    all_index_field.sort_by(&:ordinal).each do |ak|
      trace :composition, ak.inspect
    end
  end
end