title: How to check if a value of a field exists in Ruby
body: <p>I encountered a problem when editing a record. My issue is, when I edit a record, I have to check a field called <code>serial_number</code>. If it exists in my database (table contracts) the program will show the message to announce users that this value was existed, and if not then save to database.</p>
  
  <p>Now I am confused of how to check that the <code>serial_number</code>'s value is existed or not.  </p>
  
  <p>I used  <code>Contract.exists?(params[:serial_nuber])</code> to check, but it returns false while <code>serial_number</code> value existed in <code>contracts</code> table before.</p>
  
  <p>Can someone suggest how I solve this problem?</p>