Thanks! I figured out another way, involving some trickery. Your way
is probably more recommended.
I created a model named people_role.rb. Note the first part of the name
is the plural form of Person, and the second part is the singular of the
Role table. I did that because rails will pluralize the word
people_role into people_roles, and people_roles is the name of my table.
Then I can call PeopleRole.delete_all and it appears to work.
Hmm, ran into a glitch further down the road so I redid everything your
way and that works better.
For some reason each join table row had it's own id. In this case the
join table columns were role_id, person_id, and id. My problem was that
when saving each join table row, it was setting the id to the role_id,
and since my role_id's weren't unique within the join table, the saves
were failing. I have no idea why it was doing that.
interesting . . . next question then, why when I save a person with a
role would active record be setting the id of the join row to the
role_id? Since I reuse roles I was getting constraint violation type
errors because it was trying to save a people_roles row the the same id
as another row.
What was the exact error you were getting and what code were you using to get it? You should be able to assign many roles to many people and vice-versa ad infinitum ergo (and any other trippy words)