class JamRuby::Event < ActiveRecord::Base

  attr_accessible :slug, :title, :description, :show_sponser, :social_description, as: :admin

  validates :slug, uniqueness: true, presence: true
  validates :show_sponser, :inclusion => {:in => [true, false]}

  before_validation     :sanitize_active_admin

  def sanitize_active_admin
    self.social_description = nil if self.social_description == ''
  end

  has_many :event_sessions, class_name: 'JamRuby::EventSession'
end
