32 lines
774 B
Ruby
32 lines
774 B
Ruby
# typed: true
|
|
class ApplicationController < ActionController::Base
|
|
include T::Sig
|
|
include T::Helpers
|
|
include Pundit::Authorization
|
|
|
|
before_action do
|
|
if Rails.env.development? || Rails.env.staging?
|
|
Rack::MiniProfiler.authorize_request
|
|
end
|
|
end
|
|
|
|
before_action :authenticate_user!
|
|
|
|
# Pundit authorization error handling
|
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
|
|
|
protected
|
|
|
|
def set_ivfflat_probes!
|
|
ReduxApplicationRecord.connection.execute("SET ivfflat.max_probes = 10")
|
|
ReduxApplicationRecord.connection.execute("SET ivfflat.probes = 10")
|
|
end
|
|
|
|
private
|
|
|
|
def user_not_authorized
|
|
flash[:alert] = "You are not authorized to perform this action."
|
|
redirect_back(fallback_location: root_path)
|
|
end
|
|
end
|