18 lines
366 B
Ruby
18 lines
366 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ApplicationController < ActionController::Base
|
|
skip_before_action :verify_authenticity_token
|
|
|
|
before_action :ensure_authentication
|
|
|
|
protected
|
|
|
|
def ensure_authentication
|
|
redirect_to login_path if current_user.blank?
|
|
end
|
|
|
|
def current_user
|
|
@current_user ||= User.find_by(id: session[:current_user_id])
|
|
end
|
|
end
|