Skip to content

Commit

Permalink
Fix issue with Model#delete if the primary key is not id
Browse files Browse the repository at this point in the history
  • Loading branch information
Yacine Petitprez committed May 25, 2018
1 parent 0db0a32 commit d2e0de1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/clear/model/modules/has_saving.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module Clear::Model::HasSaving
return false unless persisted?

with_triggers(:delete) do
Clear::SQL::DeleteQuery.new.from(self.class.table).where({id: id}).execute
Clear::SQL::DeleteQuery.new.from(self.class.table).where{ var("#{self.class.pkey}") == pkey }.execute

@persisted = false
clear_change_flags
Expand Down

0 comments on commit d2e0de1

Please sign in to comment.