app/models/questionnaire.rb in hackathon_manager-0.5.11 vs app/models/questionnaire.rb in hackathon_manager-0.6.0

- old
+ new

@@ -1,9 +1,11 @@ class Questionnaire < ApplicationRecord include ActiveModel::Dirty before_validation :consolidate_school_names + after_create :queue_triggered_email_create + after_update :queue_triggered_email_update after_save :update_school_questionnaire_count after_destroy :update_school_questionnaire_count validates_presence_of :first_name, :last_name, :phone, :date_of_birth, :school_id, :experience, :shirt_size, :interest validates_presence_of :gender, :major, :level_of_study @@ -178,7 +180,15 @@ elsif saved_change_to_school_id? old_school_id = saved_changes['school_id'].first School.decrement_counter(:questionnaire_count, old_school_id) if old_school_id.present? School.increment_counter(:questionnaire_count, school_id) end + end + + def queue_triggered_email_update + Message.queue_for_trigger("questionnaire.#{acc_status}", id) if saved_change_to_acc_status? + end + + def queue_triggered_email_create + Message.queue_for_trigger("questionnaire.#{acc_status}", id) end end