Skip to content

Instantly share code, notes, and snippets.

@thbishop
Created March 28, 2011 15:52
Show Gist options
  • Select an option

  • Save thbishop/890707 to your computer and use it in GitHub Desktop.

Select an option

Save thbishop/890707 to your computer and use it in GitHub Desktop.
calling the mailer
@user = User.invite_without_notification!
@group = Group.find_by_name('foo')
@group.memebers << @user
GroupMailer.welcome_invitation(@group, @user).deliver
class GroupMailer < ActionMailer::Base
default :from => "support@example.com"
def welcome_invitation(group, user)
@group = group
@user = user
mail(:to => user.email, :subject => 'A group has been shared with you')
end
end
<p>Hello <%= @user.email %>!</p>
<p>Someone has invited you to join a group called <%= @group.name %> on <%= root_url %>, you can accept it through the link below.</p>
<p><%= link_to 'Accept invitation', accept_invitation_url(@user, :invitation_token => @user.invitation_token) %></p>
<p>If you don't want to accept the invitation, please ignore this email.<br />
Your account won't be created until you access the link above and set your password.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment