Hello, Suppose I have the following tables: table X ( id name ) table Y ( id name ) And I have a many to many relation between them. So, I put in each of the tables the "has_and_belongs_to_many". In the real database it should be a X_Y join table. Do I have to create that table with a migration or the model will take care of that?
on 2007-06-12 11:27
on 2007-06-12 11:40
you have to create it with a migration (or by hand, phpmyadmin, or some other software) example: Model 1: Post Model 2: Authror Join table: authors_posts Rule for the table name: order of model names alphabetically. both model names pluralized generally i suggest has_many_through over has_and_belongs_to_many, as it let's you access the join table thorugh it's own model...