app/models/questionnaire.rb in hackathon_manager-0.13.1 vs app/models/questionnaire.rb in hackathon_manager-0.13.2
- old
+ new
@@ -5,16 +5,26 @@
after_create :queue_triggered_email_create
after_update :queue_triggered_email_update
after_save :update_school_questionnaire_count
after_destroy :update_school_questionnaire_count
+ belongs_to :user
+ belongs_to :school
+ belongs_to :bus_list, optional: true
+
+ validates_uniqueness_of :user_id
+
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, :graduation_year, :race_ethnicity
validates_presence_of :agreement_accepted, message: "Please read & accept"
validates_presence_of :code_of_conduct_accepted, message: "Please read & accept"
validates_presence_of :data_sharing_accepted, message: "Please read & accept"
+ DIETARY_SPECIAL_NEEDS_MAX_LENGTH = 500
+ validates_length_of :dietary_restrictions, maximum: DIETARY_SPECIAL_NEEDS_MAX_LENGTH
+ validates_length_of :special_needs, maximum: DIETARY_SPECIAL_NEEDS_MAX_LENGTH
+
# if HackathonManager.field_enabled?(:why_attend)
# validates_presence_of :why_attend
# end
has_attached_file :resume
@@ -25,13 +35,10 @@
validates :portfolio_url, url: { allow_blank: true }
validates :vcs_url, url: { allow_blank: true }
validates_format_of :vcs_url, with: %r{((github.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub or BitBucket url"
- belongs_to :school
- belongs_to :bus_list, optional: true
-
strip_attributes
POSSIBLE_EXPERIENCES = {
"first" => "This is my 1st hackathon!",
"experienced" => "My feet are wet. (1-5 hackathons)",
@@ -107,11 +114,9 @@
validates_inclusion_of :experience, in: POSSIBLE_EXPERIENCES
validates_inclusion_of :interest, in: POSSIBLE_INTERESTS
# validates_inclusion_of :school_id, :in => School.select(:id)
validates_inclusion_of :shirt_size, in: POSSIBLE_SHIRT_SIZES
validates_inclusion_of :acc_status, in: POSSIBLE_ACC_STATUS
-
- belongs_to :user
def email
user&.email
end