Class: ArDiagram::Table

Inherits:
Base
  • Object
show all
Defined in:
app/models/ar_diagram/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#field_relationshipsObject (readonly)

Returns the value of attribute field_relationships.



10
11
12
# File 'app/models/ar_diagram/table.rb', line 10

def field_relationships
  @field_relationships
end

Instance Method Details

#add_fields(fields = nil) ⇒ Object



12
13
14
15
16
17
# File 'app/models/ar_diagram/table.rb', line 12

def add_fields fields = nil
  add_fields = fields || self.model.attribute_names
  add_fields.each do |field|
    self.dbd_fields.create({:name => field})
  end
end

#field_relationship(field) ⇒ Object



36
37
38
# File 'app/models/ar_diagram/table.rb', line 36

def field_relationship field
  return field_relationships[field]
end

#modelObject



19
20
21
22
23
24
25
# File 'app/models/ar_diagram/table.rb', line 19

def model
  begin
    return Object.const_get self.name
  rescue
    return nil
  end
end