Add validation for email and coc

This commit is contained in:
Rishabh Singh 2019-08-16 16:56:05 +05:30
parent c7ed538ba8
commit b0c8b7a60a

View file

@ -25,10 +25,15 @@ class Booth < ApplicationRecord
:state, :state,
:responsibles, :responsibles,
:conference_id, :conference_id,
:email,
:website_url, :website_url,
:submitter_relationship, :submitter_relationship,
presence: true presence: true
validates :accepted_code_of_conduct, acceptance: {
if: -> { conference.try(:code_of_conduct).present? }
}
scope :accepted, -> { where(state: 'accepted') } scope :accepted, -> { where(state: 'accepted') }
scope :confirmed, -> { where(state: 'confirmed') } scope :confirmed, -> { where(state: 'confirmed') }