I have an ActionMailer, which has a corresponding controller (shown
below). The form to create the email gets invoked from another form, a
list of names and email addresses from another Model. I would like to
return to this list after the mail is sent (for now, however, I am
merely trying to return to Application.home() )
Nothing happens – nothing with the view changes after I click send on
the form that feeds sendmail(), though the sendmail() gets executed
and the mail properly sent. When I look into my logs, I see:
ActionView::MissingTemplate (Missing template emailer/list.erb in view
path app/views):
app/controllers/emailer_controller.rb:11:in `sendmail’
Rendering rescues/layout (internal_server_error)
But I do have an application controller and it does have a home
method. Why does ActionMailer not forward onto there in my render
command? How, typically, can I put the view back to what it WAS before
the user elected to send an email ? -Janna B
I have an ActionMailer, which has a corresponding controller (shown
below). The form to create the email gets invoked from another form, a
list of names and email addresses from another Model. I would like to
return to this list after the mail is sent (for now, however, I am
merely trying to return to Application.home() )
So do you actually want redirect_to rather than render ?
I’m trying to implement this on a Blackberry (whose support for
Javascript is something of a joke, even when it is enabled) there has
to be a proper way to redirect this in rails which does not involve
javascript. It seems neither redirect_to nor render get called
(though, the puts line above it does, and the mail is correctly
sent!).
So why can;t a redirect anywhere after this? -Janna B
According to the quoted exception the problem here is not the
redirect. It is the actionmailer which doesnt find the template to
render the email. This raises an exception and prevents further
processing of your controller action. Name your email templates in the
form name.text.plain.erb or name.text.html.erb depending on the mime
type.