Let's assume the user will want to remove their own application. You can do something like this:
class UsersController < ApplicationController
def show
@applicants = current_user.applicants # or @user.find(params[:id]), whatever you prefer
end
end
class ApplicantsController < ApplicationController
def destroy
current_user.applications.find(params[:id]).destroy
redirect_to :back # or whereever
end
end
And in your view:
- @applicants.each do |applicant|
= form_for applicant, method: :delete do |f|
= f.submit
Don't forget to set a route:
resources :applicants, only: :destroy
Some observations, I would probably name the association application
instead of applicant. So has_many :applications, class_name: 'Applicant'
.