Skip to content
This repository has been archived by the owner on Dec 10, 2017. It is now read-only.

Implement RSVP mailer #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/rsvps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def create

respond_to do |format|
if @rsvp.save
RSVPMailer.rsvp_email(current_user, @rsvp.event).deliver
format.html { redirect_to(@event, :notice => 'Thanks for RSVPing! See you there!') }
format.xml { render :xml => @rsvp, :status => :created, :location => @rsvp }
else
Expand Down
11 changes: 11 additions & 0 deletions app/mailers/rsvp_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class RSVPMailer < ActionMailer::Base
def rsvp_email(user, event)
@user = user
@event = event
mail(
:from => "[email protected]",
:to => user.email,
:subject => "[HKN] RSVP Notification"
)
end
end
3 changes: 3 additions & 0 deletions app/views/rsvp_mailer/rsvp_email.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= @user.full_name %>,

You have RSVP'd for <%= @event.title %>, starting at <%= @event.start_time.strftime('%a %m/%d/%y %I:%M%p') %>.