Fix mailer preview

This commit is contained in:
Jason Zimdars
2025-11-05 13:17:30 -06:00
committed by Stanko K.R.
parent 7a58c23e55
commit 08a7db935a
2 changed files with 17 additions and 18 deletions
@@ -0,0 +1,17 @@
class IdentityMailerPreview < ActionMailer::Preview
def email_change_confirmation
ApplicationRecord.current_tenant = "897362094"
identity = Identity.find_by(email_address: "david@37signals.com")
membership = identity&.memberships&.find_by(tenant: ApplicationRecord.current_tenant)
new_email_address = "david.new@example.com"
token = membership.send(:generate_email_address_change_token, to: new_email_address)
IdentityMailer.email_change_confirmation(
email_address: new_email_address,
token: token,
membership: membership
)
end
end
@@ -1,18 +0,0 @@
class UserMailerPreview < ActionMailer::Preview
def email_change_confirmation
ApplicationRecord.current_tenant = "897362094"
user = User.find_by(email_address: "david@37signals.com") || User.new(
name: "David",
email_address: "david@37signals.com"
)
new_email_address = "david.new@example.com"
token = user.generate_email_address_change_token(to: new_email_address)
UserMailer.email_change_confirmation(
user: user,
email_address: new_email_address,
token: token
)
end
end