20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/paranoia/active_record_5_2.rb', line 20
def delete(method = options[:dependent])
if load_target
case method
when :delete
target.delete
when :destroy
target.destroyed_by_association = reflection
target.destroy
if target.respond_to?(:paranoia_destroyed?)
throw(:abort) unless target.paranoia_destroyed?
else
throw(:abort) unless target.destroyed?
end
when :nullify
target.update_columns(reflection.foreign_key => nil) if target.persisted?
end
end
end
|