search for: fk_items_product

Displaying 2 results from an estimated 2 matches for "fk_items_product".

2006 Jan 05
13
Naming convention for foreign keys
Hi, In "Agilge Web Development With Rails" on page 217, an example of foreign keys is shown. I am however unable to find a definition of wheater the naming of the index is significant. On the above mentioned page, this line is shown in the example: constraint fk_items_product foreign key (product_id) references products(id) In "fk_items_product", "items" is pluralized but "product" is not. Is this because it is a one_to_many relationship? If so, how should I read this statement? Does it matter to Rails what the index is called? Thanks,...
2006 Feb 05
8
Agile Rails book: depot problem
...ate them). When I try to delete a product --> http://localhost:3001/admin/destroy/3 I get this error message: ActiveRecord::StatementInvalid in Admin#destroy Mysql::Error: #23000Cannot delete or update a parent row: a foreign key constraint fails (`depot_development/line_items`, CONSTRAINT `fk_items_product` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)): DELETE FROM products WHERE id = 3 Can someone explain me what''s going wrong? I''m not a MySQL expert... Before I started to use Rails, I didn''t even know what a foreign key was... Than...