title: work with rescue in Rails
body: <p>I am working with the following piece;</p>
  
  <pre><code>def index
    @user = User.find(params[:id]) 
    rescue
      flash[:notice] = "ERROR"
      redirect_to(:action =&gt; 'index')
    else 
      flash[:notice] = "OK"
      redirect_to(:action =&gt; 'index')
  end
  </code></pre>
  
  <p>Now I either case whether I have a correct ID or not, I am always getting "OK" in my view, what am I doing wrong?</p>
  
  <p>I need that when I have no ID in the DB to show "ERROR". I have also tried to use <code>rescue ActiveRecord::RecordNotFound</code> but same happens.</p>
  
  <p>All help is appreciated. </p>