0

I'm creating a rails app that contains lists. Lists are made up of:

  • List_Source (e.g. National Geographic)
  • List_Elements (e.g. Tanzania)
  • List_Tags (e.g. Travel)

A list has a single source, multiple elements, and multiple tags. A source has multiple lists. A tag is used for multiple lists.

I have models/tables for lists, sources, list_elements, and tags. How should I organize the tables so that I can pull into one master table of lists the source, elements, and tags?

william tell
  • 4,352
  • 6
  • 23
  • 27

1 Answers1

0

Railscast has the answer here. Basically you create a new model (e.g. Listable) and then use has_many_through for each of the other models to create this many to many relationship.

http://railscasts.com/episodes/47-two-many-to-many

william tell
  • 4,352
  • 6
  • 23
  • 27