A
A
Anton Misyagin2015-06-20 13:11:06
Ruby on Rails
Anton Misyagin, 2015-06-20 13:11:06

Call ActionMailer mailer method by name?

Hello, I've run into a problem.
Can't call class method like this:

UserMailer.method(:mail_method).call(user.id).deliver

throws an error
mail_method method not defined for Class

At the same time, this is how it works:
UserMailer.mail_method(user.id).deliver
I did not find a suitable method in the ActionMailer api. How to do it better?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima, 2015-06-20
@sunnmas

Try using the method Object::sendfor UserMailer
Documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question