I have an active record association setup with :dependent => :destroy, which works as intended. Then I found out I need to use delete instead of destroy due to performance, so I just changed destroy to delete_all/delete depending on the association.
When I try to delete:
shop.shop_snapshots.completed.last.delete
I get the error message:
ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "shop_snapshots" violates foreign key constraint "fk_rails_c24b24adaf" on table "inventory_items"
But why is that - I believe I have the proper setup on the snapshot:
has_many :inventory_items, :dependent => :delete_all
and it worked for destroy, so what am I doing wrong?
Thanks /Louise