Hi all, I am implementing the functionality where I have to send an email to the user with the contents already stored in the database. That i am able to do but the problem is the contents stored in the database have variables like <%= @username %> and i have to replace these variables with the values while sending the email. i.e I have a content called body in the database having value: Welcome <%= @username%>. The login and password are <%= @username %> and <%= @password%>. Now when in notifier i write body :contents => content and in the view i access it <%= @contents %>. This sends the email with the contents with variable @username. But I want to replace these variables with the values of username and password. Please let me know how to implement it. Thanks, Ruchita. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller
2007-Nov-23 09:43 UTC
Re: Sending email with the contents in the database
you can run the string manually through erb: assuming your table/col is in eg @email.content result = ERB.new(@email.content).result(binding) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---