Nola Stowe
2006-Mar-09 01:45 UTC
[Rails] ActionMailer Question -- can''t find email templates
I have a PageController that displays a form. The form is just straight HTML, I only used the form helpers for the form tag as so: -- <%= form_tag({:action => :send_request}, {:method=>:post, :name=>''childsplay''})%> -- In my page controller I have this: -- def send_request email = InfoMailer::deliver_sendrequest(params) end --- in my action mailer class I have this: controllers/info_mailer.rb --- class InfoMailer < ActionMailer::Base def sendrequest(formparms) sent_at = Time.now @to = ''info@illinoisatplay.com'' @cc = ''nola@devasap.com'' @subject = ''Thank you for your request'' @recipients = '''' @from = ''webserver@illinoisatplay.com'' @sent_on = sent_at @headers = {} @body[''name''] = formparms[:from_name] end end --- The error I get is this: ActionView::ActionViewError in Page#send_request No rhtml, rxml, or delegate template found for sendrequest.rhtml I REALLY DO have a a rhtml file at views/info_mailer/sendrequest.rhtml it contains the following: --- Dear <%=@from_name %>, Thank you for your request, we will respond shortly! --- Any ideas? .. when I assign a body the message I want to send: def sendrequest(formparms) sent_at = Time.now @to = ''info@illinoisatplay.com'' @cc = ''nola@devasap.com'' @subject = ''Thank you for your request'' @recipients = '''' @from = ''webserver@illinoisatplay.com'' @sent_on = sent_at @headers = {} #@body = ''Thank you, the request is being processed'' end --- That works ok, it just doesn''t seem to be finding the template. What am I doing wrong?? -- http://PhpGirl.blogger.com http://CodeSnipers.com
Mark Reginald James
2006-Mar-10 05:06 UTC
[Rails] Re: ActionMailer Question -- can''t find email templates
Nola Stowe wrote:> ... > -- > def send_request > email = InfoMailer::deliver_sendrequest(params) > end > --- > > in my action mailer class I have this: > controllers/info_mailer.rb > ...Mailers are usually put in the models directory, and their deliver methods are usually called as class methods using the dot notation, rather than with the :: notation. -- We develop, watch us RoR, in numbers too big to ignore.