ruby - which one is better practice to deliver email in rails? -


i have following fakemailer class sending emails.

class fakemailer < actionmailer::base   def fake_method_1(recipient, subject)     mail(to: email, subject: "#{rails.env} - #{message}", body: body).deliver   end    def fake_method_2(recipient, subject)     mail(to: email, subject: "#{rails.env} - #{message}", body: body)   end  end 

both of fake_method_1 , fake_method_2 send out same email. do

fakemailer.fake_method_1(recipient, subject) fakemailer.fake_method_2(recipient, subject).deliver 

which 1 better practice? in other words, should return mail instance deliver, or deliver directly fakemailer class? what's trade-off?

thanks

the second option. if someday want deliver_later instead? i'm sure there other reasons not call deliver within method well.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -