Closed jolks closed 8 years ago
Hi @jolks,
What does this change, exactly?
Hi @preston,
Previously, in railroady/models_diagram.rb, the macro == 'belongs_to'
would go to ELSE block in IF-ELSE block at line 298. Hence, belongs_to would have assoc_type = 'many-many'
.
The DOT graph edge for assoc_type = 'many-many'
in railroady/diagram_graph.rb is arrowtail=crow, arrowhead=crow
at line 125. In other words, previously, the macro == 'belongs_to'
will appear as:
->------<-
Unfortunately belongs_to
does not really equate to many-many
based on http://guides.rubyonrails.org/association_basics.html#belongs-to-association-reference vs. http://guides.rubyonrails.org/association_basics.html#has-and-belongs-to-many-association-reference.
Therefore this change is to differentiate the belongs_to
from many-many
in which belongs_to DOT graph edge is set to appear as:
-------->
This change is very helpful for Rails project with many models consisting of multiple belongs_to
and many-many
associations. Keeping track of them will be difficult if both associations appear the same.
Ok, I'll check it out!
Cool, let me know if there is any concern or changes that I should do.
Done! Will be in v1.4.0. Sorry for the lame long delay.
No worries, thanks for the merge and release!
Activated with existing switch --show-belongs_to e.g.
$ railroady -a --show-belongs_to -M | dot -Tpng > full_models.png
We can also add new related tasks to railroady.rake.