title: how to add and display custom errors in rails2
body: <p>I have a controller action create and before I save a record I am checking one record in database and if it exists it will save.. Otherwise I need to display error as "Record Not Found". Also I have certain validations defined for this model.</p>
  
  <pre><code>if @issue.empty?
    @project.save
            format.js {render :action=&gt; 'create'}
  
          else
            @error = true
            format.html{render :action=&gt; 'new'}
            format.js {render :action=&gt; 'create'}
  
  end
  </code></pre>
  
  <p>How will I add it in the @errors object and display it.. I am rendering errors partial and looping each error msgs...</p>