candidate creation

This commit is contained in:
Mark Moser
2016-07-31 14:47:15 -05:00
parent 7758f8993c
commit abb3dee9f5
8 changed files with 92 additions and 8 deletions

View File

@ -7,9 +7,18 @@ class RecruiterController < ApplicationController
def new
@candidate = Candidate.new
render :form
end
def create
@candidate = Candidate.create(candidate_params.merge(recruiter_id: current_recruiter.id))
if @candidate.persisted?
redirect_to recruiter_path, flash: { notice: "Sucessfully created candidate #{@candidate.name}" }
else
flash[:error] = "Failed to save Candidate."
render :form
end
end
def login