many to many, error on relation

Yes. There are tons of tutorials, books, and such. Also there is
always the Rails and Ruby API.
Agile web development with rails has an excellant chapter on
relationship so does the RoR website's How To section.