Hi my name is Nathan,
I am building a website using Ruby on Rails and a MySQL database. The
premise is that every news item and piece of article content or a
download etc each has it’s own forum.
Currently I have it set up so that my News, Content, and Downloads
tables each have a discussion_id column. The Discussion table is then
referenced by Forums, Forums are referenced by Threads and Threads are
referenced by Posts.
This way any piece of content on my website can have it’s own set of
The problem is that Discussion has no way of knowing which table is
referencing it. If I am viewing a thread on my website, I want to be
able to have links that take you back to the article you were viewing or
the main page that article is stored on such as the news page, but I
can’t do that without knowing what is referencing the Discussion. Be it
News or Articles or Downloads or whatever.
How can I use single-table inheritance with a ‘type’ column in my Forums
table, to eliminate the Discussions table all together? This way several
forums could reference the news item or a download directly.
Thank you for your help, I am catching on quickly to Ruby on Rails
symantics but this single-table inheritance stuff is crazy talk and I
don’t know how to make it work.