Initial commit - Fase 1: Setup Rails + Docker

This commit is contained in:
2026-06-10 17:40:07 -03:00
commit eb812868e5
30 changed files with 1390 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
include Pundit::Authorization
before_action :authenticate_user!
before_action :set_tema
# Pundit: redireciona se não autorizado
rescue_from Pundit::NotAuthorizedError do |e|
flash[:alert] = "Você não tem permissão para realizar esta ação."
redirect_to root_path
end
private
def set_tema
@tema = current_user&.tema_preferido || 'dark'
end
def after_sign_in_path_for(resource)
if resource.motorista?
motorista_dashboard_path
else
dashboard_path
end
end
end