title: How to avoid the error on nil object
body: <p>Record id 116 doesn't exist so it should return nil to @conversation.<br>
  I tried to make it redirect when it gets nil, but it still shows the error when I access example.com/messages/show?id=116 .</p>
  
  <p>The error is</p>
  
  <blockquote>
    <p>undefined method `is_participant?' for nil:NilClass</p>
  </blockquote>
  
  <p>I definitely see 'is_participant' method existing in<br>
  /usr/local/lib/ruby/gems/1.9.1/gems/mailboxer-0.7.0/app/models/conversation.rb</p>
  
  <p>messages_controller.rb</p>
  
  <pre><code>def show
    @conversation = Conversation.find_by_id(params[:id])
  
    unless @conversation.is_participant?(current_user)
      flash[:alert] = "You do not have permission to view that conversation."
      redirect_to :controller =&gt; 'messages', :action =&gt; 'received'
    end
  
    @messages = Message.find_by_id(params[:id])
    current_user.read(@conversation)    
  end
  </code></pre>