Check out the Rails Recipies book by Pragmatic Programmers there are two lengthy articles in it concerning exactly what you are asking about here Namely "self-referential Many-to-Many relationships" and "Many-to-Many Relationships where the relationship itself has data"

I've only glanced over them briefly so far so I can't really give much more help but I can definately recommend the book!