title: Ruby on Rails: How do you check if a file is an image?
body: <p>How would you check if a file is an image? I'm thinking you could use an method like so:</p>
  
  <pre><code>def image?(file)
    file.to_s.include?(".gif") or file.to_s.include?(".png") or file.to_s.include?(".jpg")
  end
  </code></pre>
  
  <p>But that might be a little inefficient and not correct. Any ideas?</p>
  
  <p>(I'm using the paperclip plugin, btw, but I don't see any methods to determine whether a file is an image in paperclip)</p>