lib/railroady/diagram_graph.rb in railroady-1.3.1 vs lib/railroady/diagram_graph.rb in railroady-1.4.0
- old
+ new
@@ -95,12 +95,12 @@
options = 'shape=box, style=dotted, label="' + name + '"'
when 'aasm'
# Return subgraph format
return "subgraph cluster_#{name.downcase} {\n\tlabel = #{quote(name)}\n\t#{attributes.join("\n ")}}"
end # case
- options = [options, custom_options].compact.join(', ')
- "\t#{quote(name)} [#{options}]\n"
+ options = [options, custom_options].compact.reject{|o| o.empty?}.join(', ')
+ return "\t#{quote(name)} [#{options}]\n"
end # dot_node
# Build a DOT graph edge
def dot_edge(type, from, to, name = '')
options = name != '' ? "label=\"#{name}\", " : ''
@@ -110,10 +110,13 @@
when 'one-one'
options += 'arrowtail=odot, arrowhead=dot' + suffix
when 'one-many'
options += 'arrowtail=odot, arrowhead=crow' + suffix
when 'many-many'
- options += 'arrowtail=crow, arrowhead=crow' + suffix
+ options += "arrowtail=crow, arrowhead=crow" + suffix
+ when 'belongs-to'
+ # following http://guides.rubyonrails.org/association_basics.html#the-belongs-to-association
+ options += "arrowtail=none, arrowhead=normal" + suffix
when 'is-a'
options += 'arrowhead="none", arrowtail="onormal"'
when 'event'
options += 'fontsize=10'
end