class JamRuby::EventBriteOrder < ActiveRecord::Base


  belongs_to :live_stream, class_name: 'JamRuby::LiveStream'
  belongs_to :event_brite_order_upload, class_name: 'JamRuby::EventBriteOrderUpload'

  validates :event_name, presence: true
  validates :order_id, presence: true
  validates :ticket_count, presence: true
  validates :ticket_type, presence: true

  before_validation     :sanitize

  def sanitize
    self.first_name.strip! if self.first_name
    self.last_name.strip! if self.last_name
    self.email.strip! if self.email
    self.ticket_type.strip! if self.ticket_type
    self.order_id.strip! if self.order_id
    self.event_name.strip! if self.event_name
  end
end
