[openstreetmap/openstreetmap-website] Enable ActionMailer Previews (PR #6449)

Tom Hughes notifications at github.com
Wed Oct 15 19:26:28 UTC 2025


@tomhughes commented on this pull request.

Looks great to me!

> +class UserMailerPreview < ActionMailer::Preview
+  include FactoryBot::Syntax::Methods
+
+  # Wraps the preview in a transaction, so that no changes
+  # are persisted to the development db
+  def self.call(...)
+    preview = nil
+    ActiveRecord::Base.transaction do
+      preview = super(...)
+      raise ActiveRecord::Rollback
+    end
+    preview
+  end
+
+  def diary_comment_notification
+    recipient = create(:user)

This should probably set the user language so that the local selector in the preview works - something like:

```suggestion
    recipient = create(:user, :languages => [I18n.locale])
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6449#pullrequestreview-3341932718
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6449/review/3341932718 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251015/a175962f/attachment.htm>


More information about the rails-dev mailing list