Skip to content

Commit

Permalink
model:delete()
Browse files Browse the repository at this point in the history
Can't believe I forgot that!
  • Loading branch information
Etiene committed Jan 10, 2014
1 parent b015542 commit 26a7261
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/model.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ function model:find_all(where_string)
return res
end

function model:delete()
local id = self[self.db.key]
if id and self:find(id) then
return (db.query("delete from "..self.db.table.." where "..self.db.key.."='"..id.."';") ~= 0)
end
return false
end

return model


0 comments on commit 26a7261

Please sign in to comment.