Skip to content

Instantly share code, notes, and snippets.

@vitalyp
Created June 30, 2021 01:19
Show Gist options
  • Save vitalyp/e3cb2d2d01e12ca8e16fd47ff7f23e56 to your computer and use it in GitHub Desktop.
Save vitalyp/e3cb2d2d01e12ca8e16fd47ff7f23e56 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
after_filter :allow_iframe
protect_from_forgery with: :exception
private
def current_user
User.first
#@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
helper_method :current_user
def require_login
unless current_user
#flash[:error] = "You must be logged in to access this section"
redirect_to new_session_path
end
end
def allow_iframe
response.headers.delete "X-Frame-Options"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment