26 lines
641 B
Ruby
26 lines
641 B
Ruby
class ApplicationController < ActionController::Base
|
|
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
|
allow_browser versions: :modern
|
|
|
|
# Changes to the importmap will invalidate the etag for HTML responses
|
|
stale_when_importmap_changes
|
|
|
|
before_action :authenticate_user!
|
|
helper_method :current_user
|
|
|
|
private
|
|
|
|
def authenticate_user!
|
|
unless current_user
|
|
redirect_to root_path, alert: "Please log in first"
|
|
end
|
|
end
|
|
|
|
def current_user
|
|
@current_user ||= User.find_by(id: session[:user_id])
|
|
end
|
|
|
|
def skip_authentication_check
|
|
true
|
|
end
|
|
end
|