I have a database the have orders, and which order many order items, that kinds of thing. I deleted one product carelessly, and it is related to the order items, so it can't load successfully. So, I use the SQLite Database开发者_高级运维 Browser to delete the orders and order items. But after I restart the server, it prompt me that :
We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly.
Notice that I am using the development mode.
Did you save the database and close the SQLite browser? Your database may be locked.
You may also have forgotten to delete certain orders, so it's looking for a product that doesn't exist.
In the future, make sure you're in development mode, since that tends to offer more descriptive error messages.
This is a standard Rails error message. You should look the development log to figure out what exactly is happening.
You can manually modify your record as soon as your changes don't break data integrity.
It's recommended you use ActiveRecord :dependent
association option to specify what ActiveRecord should to when a record of that specific class is destroyed.
Also note that record.delete
is different than record.destroy
. The first one doesn't execute associated callbacks.
精彩评论