Add letter-opener

This commit is contained in:
Max Wofford 2025-03-07 18:10:32 -05:00
parent 933f8f2ba2
commit 62e951e300
3 changed files with 30 additions and 0 deletions

View file

@ -77,6 +77,10 @@ group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
# Preview emails in the browser [https://github.com/ryanb/letter_opener]
gem "letter_opener"
gem "letter_opener_web", "~> 3.0"
# Rack Mini Profiler [https://github.com/MiniProfiler/rack-mini-profiler]
gem "rack-mini-profiler"
# For memory profiling via RMP

View file

@ -115,6 +115,8 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (5.1.0)
logger (~> 1.5)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crass (1.0.6)
@ -208,6 +210,17 @@ GEM
thor (~> 1.3)
zeitwerk (>= 2.6.18, < 3.0)
language_server-protocol (3.17.0.4)
launchy (3.1.1)
addressable (~> 2.8)
childprocess (~> 5.0)
logger (~> 1.6)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
letter_opener_web (3.0.0)
actionmailer (>= 6.1)
letter_opener (~> 1.9)
railties (>= 6.1)
rexml
lint_roller (1.1.0)
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
@ -472,6 +485,8 @@ DEPENDENCIES
importmap-rails
jbuilder
kamal
letter_opener
letter_opener_web (~> 3.0)
memory_profiler
paper_trail
pg

View file

@ -7,6 +7,12 @@ class AdminConstraint
end
end
class DevelopmentConstraint
def self.matches?(request)
Rails.env.development?
end
end
Rails.application.routes.draw do
constraints AdminConstraint do
mount Avo::Engine, at: Avo.configuration.root_path
@ -16,6 +22,11 @@ Rails.application.routes.draw do
end
get "/stop_impersonating", to: "sessions#stop_impersonating", as: :stop_impersonating
constraints DevelopmentConstraint do
# Preview emails in the browser [https://github.com/ryanb/letter_opener]
mount LetterOpenerWeb::Engine, at: "/letter_opener", as: :letter_opener
end
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check