Forum Discussion

KonstantinDA's avatar
KonstantinDA
Frequent Visitor
2 years ago

Data modeling help

Hi, I'm having trouble figuring out how to solve this problem. I want to display photo thumbnails in a single table visual.

I have three sequentially related tables: ScoutReport, ReportPoint, PointIssue. So, one scout report can contain many points, and each point can have multiple issues.

 

The photos are stored in another resource - Photo. It has columns photoable_type (FieldScoutReport, ScoutReportPoint, ScoutReportPointIssue) and photoable_id.

 

I can create three separate tables and connect each one to its respective type, but then I need to filter a lot to select all photos for a single scout report.

 

I also tried connecting the three different photo tables to the last one in the chain - PointIssue, by using RELATED to link all the ids from ScoutReport and ReportPoint. This solution doesn't seem elegant due to many-to-many relationships.

 

Is there a more elegant solution for this, please?

1 Reply