Action mailer rails 6
Hey Chris,
cannot send email from console using UserMailer.welcome_email.perform_now, geting this error
Traceback (most recent call last):
1: from (irb):3
NameError (uninitialized constant UserMailer
irb(main):004:0>
why is it saying (uninitialized constant UserMailer)
cannot send email from console using in rails 6
EmailMailer.welcome.perform_now
Traceback (most recent call last):
2: from (irb):2
1: from (irb):2:in `rescue in irb_binding'
NameError (uninitialized constant EmailMailer)
my EmailMailer
class EmailMailer < ApplicationMailer
def welcome
@greeting = "Hi"
mail to: my_email_address
end
end
I'm having the same problem in Rails 6.0.2. After generating a mailer UserMailer, running it in console results the following:
irb(main):001:0> UserMailer
Traceback (most recent call last):
1: from (irb):1
NameError (uninitialized constant UserMailer)
I've checked the file names and everything is named correction (user_mailer.rb and the class is UserMailer).
Oddly enough, running ApplicationMailer in the console is recognised.
irb(main):003:0> ApplicationMailer
=> ApplicationMailer
Has something changed since rails 5 where you can't run mailer actions from the console?