class Event < ActiveRecord::Base
  validates :title, :start_date, presence: true
  validate :startdate_before_enddate
  
  def startdate_before_enddate
    if :end_date.present?
      unless :start_date < :end_date
        errors.add(:start_date, "must be before end date")
      end
    end
  end
end