I stepped through the introduction on Action Mailer Basics here:
http://edgeguides.rubyonrails.org/action_mailer_basics.html
up through 2.1.3,
In 2.1.4, I already had a user class, so I just copied the line
UserMailer.welcome_email(@user).deliver
into my user_controller/action, modifying it to
UserMailer.welcome_email(user, contact).deliver
since I had a user and a contact I wished to reference from the body
of the email message.
When the application tries to execute that line I get the following
error:
TypeError (Mail is not a module):
app/mailers/user_mailer.rb:1:in `<top (required)>'
app/controllers/users_controller.rb:285:in `mail_contact'
app/controllers/users_controller.rb:409:in `add_contact'
user_mailer.rb looks like this:
class UserMailer < ActionMailer::Base
#include R18n::Helpers
def welcome_new_contact(user, contact)
@user = user
@senior = user.senior
mail(from: user.email, to: contact.email, subject:
t.welcome_new_contact(@senior.nickname || @senior.firstname))
end
end