开发者

The ruby on rails can't manually delete records?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜