ruby on rails - Pass parameters into an email -


i have user , admin, when users publish post, admin receive mail informed. pass parameters title of post or name of user published post. @ moment, i'm able pass name of receiver , not want. here i've done far

model method

after_create :send_email_to_admins def send_email_to_admins   group_admin = usermanager::group.where("name = ?", "administrateur").first   user.all.each |user|     if usermanager::tree.get_default.is_in_group(user,group_admin)       adminmailer.notification_mail(user).deliver_now       end   end end 

mailer method

def notification_mail(user)   @user = user   mail(to: @user.email, subject: 'publication boite à idées') end 

how can parameters of post , pass them e-mail ?

i (slightly pseudo-code-y don't explain schema)

#in post model after_create :deliver_email_notifications  def deliver_email_notifications   admin.all.each |admin|     mailer.deliver_post_notification(self,admin)   end end  #in mailer  def post_notification(post, admin)   #send email admin.email, using template has information post end 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -