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 notifybut 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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -