I had to update from Sendgrid V2 to V3. I am using the Sendgrid-ruby gem 5.3.
I am getting this error
NameError (uninitialized constant PasswordController::Email):
app/controllers/password_controller.rb:54:in `send_email'
May 06 08:57:01 burro-staging app/web.1: ArgumentError (wrong number of arguments (given 1, expected 0)):
Here is the line causing the issue (2nd line below).
mail = SendGrid::Mail.new
mail.from = Email.new(email: 'no-reply@getburro.com') <-----
Ruby is looking for Email
class and couldn't find it. The reason is because Email
belongs to Sendgrid
module, and should be scoped like so:
Sendgrid::Email.new
...
as can be seen here:
module SendGrid
class Email
attr_accessor :email, :name
def initialize(email: nil, name: nil)
...
And from the docs: https://github.com/sendgrid/sendgrid-ruby#with-mail-helper-class