xavierlacot / joli.js

joli.js is an Activerecord-like javascript ORM, particularly suited for being used in the Appcelerator Titanium Mobile framework.
MIT License
267 stars 60 forks source link

method destroy may delete everything in the table #38

Open wishper opened 11 years ago

wishper commented 11 years ago

Hi, thanks for fixing #37 However, the fix changed a bit the behaviour of destroy function Previously, if record was unsaved, it correctly threw an exception

After #37 , unsaved record have typeof this.id === 'object', so does not fire the exception

However, the deleteRecords function does not find the id, and so it does not create the 'where' clause, executing "delete from "