I18n + ActionMailer = conflict?

Hi there,

can anybody tell me why I get the error message:

“undefined method ‘t’ for #Mailer:0xb6d501e0

… when I call the following Mailer?

=================================
class Mailer < ActionMailer::Base

def signup_notification(user)
@recipients = “#{user.email}”
@from = APP_CONFIG[‘mail’][‘sender’]

@subject     = "#{APP_CONFIG['settings']['name']} - "
@subject    += "#{ t('.activate_new_account') }."

@body[:user] = user
@body[:url]  =

“http://#{APP_CONFIG[‘settings’][‘domain’]}/activate/#{user.activation_code}”
@sent_on = Time.now
end

end

(See the translation in the 2 “@subject” lines)

Does I18n have a problem with ActionMailer or what am I missing?

Thanks a bunch for any hint!
Tom

Ok, figured it out:

In a Mailer model, translations can not be accessed using the shortcut:

t(…)

You have to use it this way:

I18n.t(…)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs