title: Checking for nil strings in Rails view
body: <p>I'm looking for a good shortcut for Nil checking in my Rails views. I've seen other questions on SO about this, but none seem to simplify this as much as I'd like. What I'd like is a short syntax to return an empty string <code>""</code> if a particular value is nil, otherwise return the value.</p>
  
  <p>There is a suggestion <a href="http://hobocentral.net/blog/2007/08/25/quiz/" rel="nofollow">here</a> which I am inclined to try out. It basically allows a statement like this:</p>
  
  <pre><code>user.photo._?.url
  </code></pre>
  
  <p>-- or -- </p>
  
  <pre><code>user.photo.url._?
  </code></pre>
  
  <p>Is this a good idea or is it fraught with peril?</p>
  
  <p>My other option would be to handle nils on my models, but that seems too global.</p>