Commit e5d5265e authored by Rajendra Kadam's avatar Rajendra Kadam

Use service block inside destroy_conditionally

parent d9729611
...@@ -306,7 +306,10 @@ module API ...@@ -306,7 +306,10 @@ module API
key = user.keys.find_by(id: params[:key_id]) key = user.keys.find_by(id: params[:key_id])
not_found!('Key') unless key not_found!('Key') unless key
::Keys::DestroyService.new(current_user).execute(key) destroy_conditionally!(key) do |key|
destroy_service = ::Keys::DestroyService.new(current_user)
destroy_service.execute(key)
end
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment