You can join the conditions of the inner ifs with the outer ones here:
```ruby
if params[:type] == 'post' && Post.exists?(params[:id])
  delete_post
elsif params[:type] == 'comment' && Comment.exists?(params[:id])
  delete_comment
end
```