app/models/approval/request_form/destroy.rb in approval-0.5.0 vs app/models/approval/request_form/destroy.rb in approval-0.6.0
- old
+ new
@@ -2,19 +2,21 @@
module RequestForm
class Destroy < Base
private
def prepare
- ::Approval::Request.transaction do
- request.comments.new(user_id: user.id, content: reason)
- Array(records).each do |record|
- request.items.new(
- event: "destroy",
- resource_type: record.class.to_s,
- resource_id: record.id,
- )
+ instrument "request" do |payload|
+ ::Approval::Request.transaction do
+ payload[:comment] = request.comments.new(user_id: user.id, content: reason)
+ Array(records).each do |record|
+ request.items.new(
+ event: "destroy",
+ resource_type: record.class.to_s,
+ resource_id: record.id,
+ )
+ end
+ yield(request)
end
- yield(request)
end
end
end
end
end