Skip to content

Instantly share code, notes, and snippets.

@vocino
Created May 13, 2010 20:15
Show Gist options
  • Save vocino/400402 to your computer and use it in GitHub Desktop.
Save vocino/400402 to your computer and use it in GitHub Desktop.
def sendmail
@attendee = Attendee.find(params[:id])
AttendeeMailer.deliver_invite_email(@attendee)
end
<td><%= link_to 'Email', attendee, :action => :sendmail %> |</td>
@shinsyotta
Copy link

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

@vocino
Copy link
Author

vocino commented May 13, 2010

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

@vocino
Copy link
Author

vocino commented May 13, 2010

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