New Discussion

Notifications

You’re not receiving notifications from this thread.

Best practices for self-referential habtm setup?

1
Rails
Basic concept:
Patch collecting app. There are issuing entities in the system that issue patches. That model is "issues". In many cases, these are difficult to tell apart. So I want to add a similar issues functionality that would be self referential on the issues table. 

When creating this, it should go both ways. If patch 1 looks like patch 5, then patch 5 looks like patch 1. Do I need to do double entry or would two indexes (issue_id, similar_issue_id) work? 

This can often be many different issues, so would this make more sense to have issue_id and then have similar_issues_ids as a JSON or other multiple value store?
Anyone have any thoughts on this?
Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.