From 52857b2920e61b390d4ba81aecf6ee4b79389124 Mon Sep 17 00:00:00 2001 From: Josh Pigford Date: Mon, 1 Jan 2024 18:20:41 -0600 Subject: [PATCH] Use letter_opener for dev email usage --- Gemfile | 3 +++ Gemfile.lock | 5 +++++ app/views/pages/home.html.erb | 4 ++++ config/environments/development.rb | 4 +++- config/initializers/devise.rb | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index c662c2ce7e0..bc96ff3d1e6 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,9 @@ group :development do # Hotwire-based live reloading gem "hotwire-livereload" + + # letter_opener for catching and displaying emails sent during development + gem "letter_opener" end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index a618d2d90f9..e581448d9b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,6 +163,10 @@ GEM activesupport (>= 5.0.0) json (2.7.1) language_server-protocol (3.17.0.3) + launchy (2.5.2) + addressable (~> 2.8) + letter_opener (1.8.1) + launchy (>= 2.2, < 3) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -333,6 +337,7 @@ DEPENDENCIES hotwire-livereload importmap-rails jbuilder + letter_opener pg (~> 1.1) puma (>= 5.0) rails! diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index e69de29bb2d..a73b0f305ca 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -0,0 +1,4 @@ +
+

Home

+

<%= link_to "Sign out", destroy_user_session_path, method: :delete %>

+
\ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index 18e60dfe1e0..9f0564367c0 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -37,11 +37,13 @@ config.active_storage.service = :local # Don't care if the mailer can't send. + config.action_mailer.delivery_method = :letter_opener + config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = false + config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.perform_caching = false - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5299e3b14d8..02f3f8aa34f 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -266,7 +266,7 @@ # config.navigational_formats = ['*/*', :html, :turbo_stream] # The default HTTP method used to sign out a resource. Default is :delete. - config.sign_out_via = :delete + config.sign_out_via = :get # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting