title: How can I deal with invalid IDs in before_filter?
body: <p>Let's say my controller looks like this:</p>
  
  <pre><code>class MyController &lt; ApplicationController
    before_filter :find_user,:only =&gt; [:index,:create,:update,:destroy]
    def index
       @some_objects = @user.objects.all
    end
  
    ...
  
    private
    def find_user
      @user = User.find(params[:user_id])
    end
  
  end
  </code></pre>
  
  <p>If the <code>user_id</code> param does not exist, @user will be nil.I think this is not the way:</p>
  
  <pre><code>def index
     if @user
        @some_objects = @user.objects.all
     else
        # ?
     end
  end
  </code></pre>
  
  <p>The code would look uglier having all these checks in my controller ... not to mention I'd have to duplicate a lot of the logic if other controllers are similar to this one.
  How do you deal with these cases?</p>