From 165507a9a492df792e3c6f825f25c8d6caf9267b Mon Sep 17 00:00:00 2001 From: Rasmus Kjellberg <2277443+kjellberg@users.noreply.github.com> Date: Mon, 8 Apr 2024 23:06:08 +0200 Subject: [PATCH] chore: subfolder for mailer views --- app/mailers/application_mailer.rb | 8 +++++++- .../account_mailer/invitation_email.text.erb | 0 test/mailers/previews/account_mailer_preview.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) rename app/views/{ => mailers}/account_mailer/invitation_email.text.erb (100%) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 9a23378..057ca19 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,10 @@ class ApplicationMailer < ActionMailer::Base - default from: Kiqr::Config.default_from_email + # Change the default path for mailer views + prepend_view_path "app/views/mailers" + + # Set the default layout for mailers layout "mailer" + + # Set the default from email address + default from: Kiqr::Config.default_from_email end diff --git a/app/views/account_mailer/invitation_email.text.erb b/app/views/mailers/account_mailer/invitation_email.text.erb similarity index 100% rename from app/views/account_mailer/invitation_email.text.erb rename to app/views/mailers/account_mailer/invitation_email.text.erb diff --git a/test/mailers/previews/account_mailer_preview.rb b/test/mailers/previews/account_mailer_preview.rb index 1c005d1..7630e42 100644 --- a/test/mailers/previews/account_mailer_preview.rb +++ b/test/mailers/previews/account_mailer_preview.rb @@ -1,4 +1,4 @@ -# Preview all emails at http://localhost:3000/rails/mailers/kiqr/account_mailer +# Preview all emails at http://localhost:3000/rails/mailers/account_mailer class AccountMailerPreview < ActionMailer::Preview def invitation_email AccountMailer.invitation_email(AccountInvitation.first)