Ruby on Rails deleting fixtures with foreign keys
I'm having trouble setting up the tests with fixtures that use foreign keys! And I would be much appreciated if someone could help me understand this. Let's say for example the :user_type model has a reference to the :role model, when tests get executed, and all the data in the test db is deleted to be again re-inserted, Rails deletes the data from the role model first, instead of deleting the data first from the :user_type and only then from :role . The fixtures: #roles.yml technical: name: 'Technical' obs: 'User Role for technical / maintenance users!' #user_types.yml technic: role: