title: Performing a function to check for duplicates before saving the record in the model in Rails
body: <p>This is what I have in my model. I want to check for duplicate records and I cant just use a unique index for a field since the contacts are unique per job) I am unable to do this using the following code. Am I doing it wrong? Any help is appreciated. Thanks!</p>
  
  <pre><code>before_save :check_for_duplicates?
  
  def check_for_duplicates?
    JobsPeople.find(:all, :conditions =&gt; ["job_id = ? and contact_id = ?", self.job_id, self.contact_id])
  end
  </code></pre>