#116 ✓resolved
James

Foreign key constraint prevents baskets from being deleted

Reported by James | November 18th, 2008 @ 02:07 PM | in 1.2

Summary

When deleting a basket, the user receives a error 500 if roles exist.

In the log this following stack trace appears:


ActiveRecord::StatementInvalid (Mysql::Error: Cannot delete or update a parent row: a foreign key constraint fails (`acl_production/roles_users`, CONSTRAINT `roles_users_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`)):             DELETE FROM `roles`
            WHERE `id` = 7
):
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:299:in `execute'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:167:in `update_sql'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:314:in `update_sql'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:172:in `delete_sql'
...

Which branches this occurs in is yet to be determined.

Solution

Either: * Add code to clean up associated items before destroy, or * Remove foreign key constraints

Cheers, James

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Kete was developed by Horowhenua Library Trust and Katipo Communications Ltd. to build a digital library of Horowhenua material.

People watching this ticket

Pages