skill-assessment-app/app/controllers/application_controller.rb
2016-07-31 12:33:09 -05:00

22 lines
528 B
Ruby

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def current_recruiter
@current_recruiter ||= User.find_by(id: session[:user]) if session[:user]
end
def current_candidate
@current_candidate ||= Candidate.find_by(test_hash: session[:test_id]) if session[:test_id]
end
private
def auth_params
params.require(:auth).permit(:email, :password)
end
def authorize_recruiter
redirect_to recruiter_login_path unless current_recruiter
end
end