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)