title: How do I check if a record exist?
body: <p>I have an appointment model and I want to validate if a record with the same date and hour exist.</p>
  
  <pre><code>class Appointment &lt; ActiveRecord::Base
    attr_accessible :adate, :atime, :doctor_id  
    validates :adate, :presence =&gt; true     
    belongs_to :doctor
    validates_date :adate, :after =&gt; lambda { Date.current }  
  
    validate :appointment_uniqueness
  
    def appointment_uniqueness
        # if date (:adate) and hour(:atime) exists then
        # date is not available
    end
  </code></pre>