Ask A Question

Notifications

You’re not receiving notifications from this thread.

how can i pass mailer_name into a method using noticed gem

zunaira ihsan asked in Ruby

us = User.first
email = EmailDetail.find_by_name("Welcome User Email")
UserNotification.with(email_class: "UserMailer" , email: email.function_name).deliver(us)

i am trying to pass mailer name as a params and accessing this in my method
but keeps giving me error

undefined method `with' for "UserMailer":String

why i try to access it like this

class UserNotification < Noticed::Base
deliver_by :email, mailer: :mailer_name , method: :email_name
deliver_by :database

params :email

def mailer_name
"UserMailer"
end

def email_name
params[:email]
end

end

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,387+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.