Ruby on Rails
HowToUseHasAndBelongsToMany

The goal of this howto is to show how to use the has_many, belongs_to and has_and_belongs to many attributes in a real app.
The howto : http://manuals.rubyonrails.com/read/chapter/48
Which version of \MySQL is this aimed at? on 4.1.18 using php\MyAdmin this “TYPE=\MyISAM AUTO_INCREMENT=3” causes the table imports to barf.
\MySQL version : 4.0.x. If you find a solution to use \MySQL 4.1.x please add a comment
I think \MySQL 4.1.x uses ENGINE instead of TYPE. -SamGoldman
Correction: The ‘categories_documents’ table has a syntax error: the end comma on the document_id line.
The date selects in views/document/new and document/edit barf on save missing some `klass’. So if you delete those date selects it works.


Here is an updated example of has_and_belongs_to_many


Here is a concise start to finish tutorial for has_and_belongs_to_many http://jrhicks.net/96 – jrh