I have a role based access control system with models Right, Role and
User and there are 2 join tables… rights_roles and roles_users
I have been maintaining the Right & Role data via migrations which has
created a few duplications over time and a few omissions and I’m finding
that there is a variation between my testing_db and my development_db in
the rights and rights_roles tables as well.
So I’m thinking that I can maintain just one set of fixtures for rights
and rights_users and load them into whichever db I need.
So my first questions…
-
How do I delete records from join table without id column?
from script/console test
RightsRoles.destroy_all
ActiveRecord::StatementInvalid: PGError: ERROR: column “id” does not
exist
: DELETE FROM rights_roles
WHERE “id” = NULL
- If I have new fixtures to load for just these 2 tables (rights.yml
and rights_roles.yml), how can I load them in the console?
Craig