skill-assessment-app/app/controllers/application_controller.rb

26 lines
561 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
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-08-24 12:15:12 -05:00
add_flash_types :warning, :success
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
helper_method :current_candidate
2016-07-31 09:56:02 -05:00
def styleguide
render '/styleguide'
end
2016-07-31 09:56:02 -05:00
private
def auth_params
params.require(:auth).permit(:email, :password)
end
2016-07-31 18:54:12 -05:00
def authorize_candidate
redirect_to login_path unless current_candidate
2016-07-31 18:54:12 -05:00
end
2016-07-26 11:59:23 -05:00
end