app/controllers/application_controller.rb
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def current_user
    return @current_user if defined?(@current_user)
    @current_user = if true_user.try(:staff?) && session[:impersonated_user_id]
                      User.find session[:impersonated_user_id]
                    else
                      true_user
                    end
  end
def current_user return @current_user if defined? ( @current_user ) @current_user = if true_user . try ( :staff? ) && session [ :impersonated_user_id ] User . find session [ :impersonated_user_id ] else true_user end end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .