title: How to ensure presence validation on a form before performing operations
body: <p>I've got a form that creates a device.  I want to ensure that the cabinet I'm passing to it exists.  In the device model, I've got: </p>
  
  <p><code>validates_presence_of :cabinet_id, :message =&gt; 'Please enter full cabinet name beginning with data center code'</code></p>
  
  <p>The controller does an operation with the cabinet to determine if there is an empty spot for it.  This makes the app crash if the cabinet does not exist, because it tries to use attributes of the cabinet.  </p>
  
  <p>How can I get the form to alert the user that the cabinet doesn't exist before it tries to perform the operation?</p>