ruby on rails - ActionMailer -- NoMethodError: undefined method X for MyMailer:Class -
question: why method undefined if it's there?
details:
i have simple mailer class:
class productmailer < applicationmailer def sample_email mail(to: "me@example.com") # hardcode own email test end end
and simple call productscontroller:
def sample_email productmailer.sample_email().deliver_later redirect_to @product, notice: 'email queued.' end
the email fails sent. using sidekiq process emails in background. sidekiq web ui shows failed jobs in tries page , can see why failed:
nomethoderror: undefined method `sample_email' productmailer:class
i tried rename method , restart server rails server
none of removes error. not using namespaces.
question: why method undefined if it's there?
note: found out chance method is found if name notify
but maybe that's because i'm overwriting method actionmailer base class, don't know.
answer: restart sidekiq
i created mailer class before starting sidekiq, renamed sample_email
method while sidekiq running, seems sidekiq doesn't recognize new methods on-the-fly.
i renamed method because used development environment, can change on fly...
Comments
Post a Comment