#746 ✓resolved
Lin Jen-Shin

[PATCH] Collection#destroy! with LIMIT/OFFSET destroys all data

Reported by Lin Jen-Shin | January 6th, 2009 @ 11:09 AM

I am not familiar with database and SQL, so I didn't know there's no LIMIT/OFFSET in DELETE. It surprises me that the same Query would resolve different results in SELECT and DELETE. Please read example in Gist because I don't know how to format codes in Lighthouse:

http://gist.github.com/43742

I know raise ArgumentError in DataObjectsAdapter seems dirty, stupid, and inconsistent, since perhaps there's some data storages support delete data with offset and/or limit. But it really shocked me that I have accidentally deleted ALL records with something like: data.size # => 10; data.destroy! # => all gone...

It would be helpful for someone like me who wasn't familiar with SQL if any error would raise in this situation instead of silently delete all records. Many thanks for your listening.

cheers, Jen-Shin

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 »

People watching this ticket

Pages