Created
May 13, 2010 20:15
-
-
Save vocino/400402 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sendmail | |
@attendee = Attendee.find(params[:id]) | |
AttendeeMailer.deliver_invite_email(@attendee) | |
end | |
<td><%= link_to 'Email', attendee, :action => :sendmail %> |</td> |
That will go to a URL like attendees/5/sendmail.
BTW... You can construct a URL as you did above. It has to be like:
link_to 'Email', :controller => :attendee, :action => :sendmail, :id => attendee.id, :method => :post
http://10.0.1.9:3000/attendee/sendmail/2?method=post
that's the generated url
i dropped method => post
now i'm getting this
http://10.0.1.9:3000/attendee/sendmail/2
needs to be attendeeS
but when i change it, it breaks again
actually when i change it, i now get this
http://10.0.1.9:3000/attendees/22/sendmail
needs to be /attendees/sendmail/22
right now it's giving me this when i click that:
Unknown action
No action responded to 22. Actions: create, destroy, edit, index, new, sendmail, show, and update
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would probably try:
link_to 'Email', attendee_sendmail_url(attendee), :method => :post
You need to define the route something like:
map.resources :attendees, :member => {:sendmail => :post}