I have a helper function to generate email for user as below
module ApplicationHelper
# Generate unique email for user based on their first and only cat id
def unique_email_for_user(user)
"category#{user.cats.first.id}@mywebsite.com"
end
end
I can call this unique_email_for_user function in my controllers, but not in my Mailer as below
class UserMailer < ApplicationMailer
# Call application_helpers
helper :application
# match the name to views/mailer/send_reminder.html.erb
def send_reminder(user)
@user = user
# Send email to user
mail(to: @user.email, reply_to: unique_email_for_user(@user), subject: "My email subject")
end
end
I get the error as below. I thought adding helper :application
to my Mailer would make the necessary connections, No?