1
0
mirror of https://github.com/danbee/my-images synced 2025-03-04 08:49:05 +00:00
my-images/app/controllers/application_controller.rb
2014-03-24 17:06:09 +00:00

13 lines
388 B
Ruby

class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
private
def authenticate_user!
redirect_to new_session_path unless session[:current_user_id].present?
@current_user ||= User.find_by(id: session[:current_user_id])
end
end