Hi Stack Overflowers: I'm building a Ruby on Rails application that has several different models (e.g. Movie, Song, Photo) that I am storing movie clips, mp3s and photos. I'd like for users to be able to comment on any of those Models and have control over which comments are published.
Is the best practice to create a Comment model with:
belongs_to :movie
belongs_to :song
belongs_to :photo
And then tie each Model with:
has_many :comments
Then, I'm guessing in the Comment table, I'll need a foreign key for each Model:
comment, movie_id, song_id, photo_id
Is this the correct way to build something like this, or is there a better way? Thanks in advance for your help.