8

Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.1" ?

togi
  • 814
  • 5
  • 13

3 Answers3

7

Found following from NEWS for Ruby 3.1.0.

The following default gems are now bundled gems.

net-ftp 0.1.3
net-imap 0.2.2
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
debug 1.4.0

So, i just added next 3 lines into GemFile. It worked fine.

gem 'net-smtp' # to send email
gem 'net-imap' # for rspec
gem 'net-pop'  # for rspec
togi
  • 814
  • 5
  • 13
1

I had similar issue, after debugging and troubleshooting. I made changes to the Rails version to 6.1.1.4 instead of 6.1.7. The I got similar error stating that it could not load some .rb files from the mail gem. What I did was to give them the read perssion to others.

chmod 644 .rb and the application loaded fine after that.

Shuaib Zahda
  • 205
  • 3
  • 11
0

I was getting same issue after deploying the code on server.
Version details-

Rails 6.1.5
ruby 3.1.2p20

I just install a new gem as-

gem 'net-smtp'

and issue got resolved.

S.Yadav
  • 4,273
  • 3
  • 37
  • 44