title: Not nil code that works for both sqlite3 and pg
body: <p>I have a rails app running sqlite3 in development and pg in production, currently running on Heroku. I am getting an error on my heroku app. I have a column called 'archived' which starts out as nil until the user pushes a button, then the current time gets written into the cell. Then all messages where archived != nil is then ordered by most recent.</p>
  
  <p>Below is a portion of my heroku log:</p>
  
  <blockquote>
    <p>2013-05-07T22:00:31.775149+00:00 app[web.1]: Completed 500 Internal Server Error in 34ms
    2013-05-07T22:00:31.785541+00:00 app[web.1]: 
    2013-05-07T22:00:31.785541+00:00 app[web.1]: ActionView::Template::Error (PG::Error: ERROR:  invalid input syntax for type timestamp: ""
    2013-05-07T22:00:31.785541+00:00 app[web.1]: LINE 1: ... "messages".* FROM "messages"  WHERE (archived &lt;> '') ORDER ...
    2013-05-07T22:00:31.785541+00:00 app[web.1]:                                                              ^
    2013-05-07T22:00:31.785541+00:00 app[web.1]: : SELECT  "messages".* FROM "messages"  WHERE (archived &lt;> '') ORDER BY archived desc LIMIT 10):</p>
  </blockquote>
  
  <p>This tells me that the issue is this line of code from my controller:</p>
  
  <blockquote>
  <pre><code>@archived_messages = Message.where("archived &lt;&gt; ''").limit(10).order('archived desc')
  </code></pre>
  </blockquote>
  
  <p>What should I change this code to so that it works in both sqlite3 and pg?</p>
  
  <p>Thanks in advance.</p>