Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For mailers: default_i18n_subject is reporting as missing #500

Closed
mhenrixon opened this issue Apr 17, 2023 · 1 comment · Fixed by #538
Closed

For mailers: default_i18n_subject is reporting as missing #500

mhenrixon opened this issue Apr 17, 2023 · 1 comment · Fixed by #538

Comments

@mhenrixon
Copy link

class UserMailer < ApplicationMailer
  def email_verification
    @user       = params[:user]
    @locale     = @user.locale

    I18n.with_locale(@locale) do
      mail to: @user.email, subject: default_i18n_subject
    end
  end

  def invitation_instructions
    @user       = params[:user]
    @locale     = @user.locale

    I18n.with_locale(@locale) do
      mail to: @user.email, subject: default_i18n_subject
    end
  end

  def password_reset
    @user       = params[:user]
    @locale     = @user.locale

    I18n.with_locale(@locale) do
      mail to: @user.email, subject: default_i18n_subject
    end
  end

  def passwordless
    @user       = params[:user]
    @locale     = @user.locale

    I18n.with_locale(@locale) do
      mail to: @user.email, subject: default_i18n_subject
    end
  end
end
en:
  user_mailer:
    email_verification:
      subject: Verify your email
    invitation_instructions:
      subject: Invitation instructions
    password_reset:
      subject: Reset your password
    passwordless:
      subject: Your sign in link

I was expecting the task to pick up on the subject here?

@davidwessman
Copy link
Collaborator

Probably need to add a custom matcher for this, like I did for human_attribute_name:
https://github.com/glebm/i18n-tasks/blob/main/lib/i18n/tasks/scanners/ast_matchers/rails_model_matcher.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants