Skip to content

Instantly share code, notes, and snippets.

@scottmagdalein
Created July 3, 2012 17:16
Show Gist options
  • Save scottmagdalein/3041125 to your computer and use it in GitHub Desktop.
Save scottmagdalein/3041125 to your computer and use it in GitHub Desktop.
applicants_controller#create
def create
@applicant = @position.applicants.new(params[:applicant])
@applicant.phase_id = @position.phases.order(:sort_order).first.id
respond_to do |format|
if @applicant.save
format.html { redirect_to @position, notice: 'Applicant was successfully created.' }
format.json { render json: @applicant, status: :created, location: @applicant }
else
format.html { render action: "new" }
format.json { render json: @applicant.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment