Skip to content

Instantly share code, notes, and snippets.

@roykolak
Created June 13, 2011 19:17
Show Gist options
  • Save roykolak/1023481 to your computer and use it in GitHub Desktop.
Save roykolak/1023481 to your computer and use it in GitHub Desktop.
class AppointmentObserver < ActiveRecord::Observer
def after_save(appointment)
user = appointment.user
return unless user.notifiable?
if appointment.initial?
MailService.welcome_email(user).deliver
elsif appointment.second_visit? && !user.has_logged_in?
MailService.second_chance_email(user).deliver
else
MailService.post_appointment_email(user).deliver
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment