Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove identifier from association_identity #327

Merged
merged 3 commits into from
May 13, 2019
Merged

Remove identifier from association_identity #327

merged 3 commits into from
May 13, 2019

Conversation

kerrizor
Copy link
Collaborator

@kerrizor kerrizor commented May 13, 2019

By removing the identifier, we're removing duplicates but increasing the weight.

Taking a look at the rake examples output for the "spree" application, we see that the Address model has:

has_many :billing_checkouts, :foreign_key => "bill_address_id", :class_name => "Checkout"
has_many :shipping_checkouts, :foreign_key => "ship_address_id", :class_name => "Checkout"

which, <master> generates (in output/spree.dot):

m_Address -> m_Checkout [arrowhead = "normal", arrowtail = "none", weight = "2"];
m_Address -> m_Checkout [arrowhead = "normal", arrowtail = "none", weight = "2"];

With this change, our output DOT shows this as:

m_Address -> m_Checkout [arrowhead = "normal", arrowtail = "none", weight = "4"];

I'm a bit nervous about this change; what I think I might prefer is to see an option for labelling relationships, either all of them, or when there are multiples like this that have different :foreign_key declarations, but it isn't a huge priority, something for a future release. For now, this solves the problems reported by many, many users.

Rebase of #296

See #70 (comment)

Fixes #278

(h/t to @afn who submitted the PR originally)

Numerous people are reporting segfaults in graphviz from nodes with
multiple edges. Fixing this, however, breaks these two tests that set up
this precise situation, so marking them as skipped for now. I'm a little
nervous about this change, since it is changing existing behaviour, but
enough people have reported this as an issue that I'd like to get this
into the next version and go from there.
..because rails 3.2.x uses test_unit, and in a few days (🤞) we'll be dropping
3.2 support, and this kind of ugly little bit of code can go away.

I'm trusting you, Future Kerri, don't let me down.

Love, Kerri
@kerrizor kerrizor merged commit 985b5a3 into master May 13, 2019
@kerrizor kerrizor deleted the pr-296 branch May 13, 2019 05:37
@magneticnorth
Copy link

Hi - what is the graphviz bug causing the problem? Maybe we fixed it. There was a lot of work on handling multiple edges, but the bookkeeping for arrowheads and directions was not well thought out and there could still be problems. Some parts of the code really need an overhaul. Sorry for the difficulties. north from graphviz org

@pedros007
Copy link

@magneticnorth #196 (comment) might shed some light. rails-erd would invoke GraphViz, which seg faulted. I narrowed it down to rails-erd would generate a dotfile with concentrate = "true";. When I removed that, GraphViz would no longer segfault.

@kerrizor
Copy link
Collaborator Author

@magneticnorth thank you for all the work on Graphviz!

One of my ToDos the next few weeks is to set up a series of repos that we can reproduce bugs from; if we can reproduce issues like this segfault, I can discover if the issue is our DOT generation, or something in specific versions of Graphviz; we don't really enforce or recommend any particular versions, but perhaps we should start...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while running rails-erd -> Verify that Graphviz is installed and in your path, or use filetype=dot
4 participants