I use Rails 4.1 and PostgreSQL, and I use the alien character to create foreign key constraints. But I am having problems with fixtures .
When I run:
spring rake test
I got the following errors:
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: update or delete on table "pessoas" violates foreign key constraint "pacientes_pessoa_id_fk" on table "pacientes" DETAIL: Key (id)=(980190962) is still referenced from table "pacientes". : DELETE FROM "pessoas"
I found a workaround: recreate the database:
RAILS_ENV=test spring rake db:reset && spring rake test
I get some errors when trying to seed a development database using tools with rake db:fixture:load .
I already tried to change the boot order of the device in test_helper.rb , but this was not enough.
Does anyone know how to fix this? I searched a lot on the Internet and did not find a solution.
user3153542
source share