10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/acts_as_revisable/acts/deletable.rb', line 10
def destroy
now = Time.current
prev = self.revisions.first
self.revisable_deleted_at = now
self.revisable_is_current = false
self.revisable_current_at = if prev
prev.update_attribute(:revisable_revised_at, now)
prev.revisable_revised_at + 1.second
else
self.created_at
end
self.revisable_revised_at = self.revisable_deleted_at
return false unless run_callbacks(:before_revise_on_destroy) { |r, o| r == false}
returning(self.save(:without_revision => true)) do
run_callbacks(:after_revise_on_destroy)
end
end
|