2016-07-26 11:59:23 -05:00
|
|
|
class ApplicationController < ActionController::Base
|
|
|
|
protect_from_forgery with: :exception
|
2016-07-29 11:53:01 -05:00
|
|
|
|
2016-07-31 09:56:02 -05:00
|
|
|
def current_recruiter
|
|
|
|
@current_recruiter ||= User.find_by(id: session[:user]) if session[:user]
|
|
|
|
end
|
|
|
|
|
2016-07-29 11:53:01 -05:00
|
|
|
def current_candidate
|
2016-07-31 09:56:02 -05:00
|
|
|
@current_candidate ||= Candidate.find_by(test_hash: session[:test_id]) if session[:test_id]
|
2016-07-29 11:53:01 -05:00
|
|
|
end
|
2016-07-31 09:56:02 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def auth_params
|
|
|
|
params.require(:auth).permit(:email, :password)
|
|
|
|
end
|
|
|
|
|
|
|
|
def authorize_recruiter
|
|
|
|
redirect_to recruiter_login_path unless current_recruiter
|
|
|
|
end
|
2016-07-26 11:59:23 -05:00
|
|
|
end
|