I just have a few questions about join tables. From my understanding the following applies (correct me if I'm wrong):
1.Join tables are always named with the names of the two associated tables, in alphabetical order, separated by an underscore.
2.The foreign key fields are named with the name of the table they are referencing, with _id appended.
3.The foreign key is referencing a single element in that table, so it uses the singular name.
However, I've installed both of the following plugins:
OK. That will automatically generate foreign key constraints when you have a *_id field in your migrations.
So, as an example, let's say I created 32 tables with the following type of information:
def self.up create_table :rushing_offenses do |t| t.integer :team_id
And I want to create a join table for the team_id to associate with all those tables:
How would I define the self.up for the join table? Is the naming convention necessary per above?
No join table is necessary here, since you're not doing a many-to-many association. As long as the cardinality is 1 on at least one end of the association, simple keys will do. Of course, you'll want to put has_many and belongs_to in the appropriate parts of your model code -- see the Association docs for information.
The fact that you're asking this question suggests that you need to read a lot more about relational database design. In particular, find out about normalization and especially the Third Normal Form (which is about as far as most people care to normalize without a good reason).