Frederick

Either one -- but niether get hit:

 def sendmail
       recipient = params[:email][:recipient]
       subject = params[:email][:subject]
       message = params[:email][:message]
       returnadd = current_associate.email
       puts "about to send"
       mymail = Emailer.create_contact(recipient, subject, message,
returnadd)
       Emailer.deliver(mymail);
       puts "sent!"
       redirect_to :controller => 'application', :action =>
'home'
  end

see, the "sent" is appearing....but nothing ever redirects! Any
thoughts or suggestions here on this? Thanks! -Janna B

On Jun 10, 1:24 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Jun 10, 5:46 pm, JannaB <mistressja...@hotmail.com> wrote:> 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 ?
>
> Fred
>
> > I have:
>
> > class EmailerController < ApplicationController
> >   def sendmail
> >        recipient = params[:email][:recipient]
> >        subject = params[:email][:subject]
> >        message = params[:email][:message]
> >        returnadd = current_associate.email
> >        mymail = Emailer.create_contact(recipient, subject, message,
> > returnadd)
> >        Emailer.deliver(mymail);
>
> >     render :controller => 'application', :action => 'home'
>
> >   end
> > end
>
> > 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
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to