I've created a mailer, and am pretty sure I've set its parameters
correctly.
I've created a view for that mailer, and am also pretty sure I've set
it up correctly.
I can call the mailer and it works right when I put the deliver_ in
another controller or simply on a page.
So all that's great.
BUT, what I really want to do is have a simple button that, when hit,
will trigger that mailer, passing an :id to it as well.
I can't figure out how to code the button though. Any ideas?
here's what's in the mode:
def scheduled(story)
recipients story.author.email
subject "Your story has been scheduled"
from "e-mail@example.com"
sent_on Time.now
body :story => story
end
here's the template (excerpt):
Hi <%= @story.author.name %>
....
here's the deliver_ action: Emailer.deliver_scheduled(@story)
Again, all this stuff works but I can't seem to figure out how to
simply smack a button and send an e-mail. I'm sure it's something I'm
just overlooking.
BUT, after it sends an e-mail, it wants to go to a view called
scheduled in the controller it's currently in. Which doesn't exist.
I don't want it to go anywhere. Just send the e-mail, and maybe flash
that it sent.
THAT'S my question.
Not sure I completely understand, but try adding:
render :nothing => true
as the last line in your controller method. I think you can add the
flash[:message]='blah blah' above that and that it will display, but
don't recall having used the two together before myself. Sorry I can't
be of more definitive assistance.
link_to_remote doesn't seem to do anything. Looking at the terminal
window when I hit it, it just reloads the page. I change it back to
link_to and the terminal does all the e-mail song & dance. Am I
missing a step with link_to_remote?
And render :nothing => true gets rid of the page not found error, but
instead simply displays a blank page once the e-mail has been sent.
link_to_remote doesn't seem to do anything. Looking at the terminal
window when I hit it, it just reloads the page. I change it back to
link_to and the terminal does all the e-mail song & dance. Am I
missing a step with link_to_remote?
And render :nothing => true gets rid of the page not found error, but
instead simply displays a blank page once the e-mail has been sent.
Hrm...
On Jul 16, 11:57�pm, Rodrigo Dominguez <rails-mailing-l...@andreas-