From f8ce4130cade3f98088f375c1cde752c0215aebe Mon Sep 17 00:00:00 2001 From: Godwin Date: Mon, 12 Jun 2017 22:05:04 -0700 Subject: [PATCH] Fix for deleted email confirmations --- app/mailers/user_mailer.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 0545d4b..e4ce88d 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -9,9 +9,11 @@ class UserMailer < ActionMailer::Base default from: "Bike!Bike! " def email_confirmation(confirmation) - @confirmation = EmailConfirmation.find(confirmation) if confirmation.present? - I18n.locale = @confirmation.user.locale if @confirmation.user.locale.present? - mail to: @confirmation.user.named_email, subject: clean_subject(_'email.subject.confirm_email','Please confirm your email address') + @confirmation = EmailConfirmation.find_by_id(confirmation) if confirmation.present? + if @confirmation.present? + I18n.locale = @confirmation.user.locale if @confirmation.user.locale.present? + mail to: @confirmation.user.named_email, subject: clean_subject(_'email.subject.confirm_email','Please confirm your email address') + end end def registration_confirmation(registration)