title: ActiveRecord find_each and Postgres
body: <p>I get the following error:</p>
  
  <pre><code>PGError: ERROR:  operator does not exist: character varying &gt;= integer
  LINE 1: ...CT  "games".* FROM "games"  WHERE ("games"."uuid" &gt;= 0) ORDE...
                                                               ^
  HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
  : SELECT  "games".* FROM "games"  WHERE ("games"."uuid" &gt;= 0) ORDER BY "games"."uuid" ASC LIMIT 1000
  </code></pre>
  
  <p>when I try to do this:</p>
  
  <pre><code>Game.find_each do |game|
    # ...
  end
  </code></pre>
  
  <p>I have a string (UUID) primary key for my model:</p>
  
  <pre><code>class Game &lt; ActiveRecord::Base
    self.primary_key = 'uuid'
  
    before_create do |game|
      game.uuid = UUIDTools::UUID.timestamp_create().to_s if game.uuid.blank?
    end
  end
  </code></pre>
  
  <p>I don't know why ActiveRecord is putting in that <code>WHERE</code> clause but it's completely unnecessary and the cause for the type error (since it's a string column, not an integer one).</p>
  
  <p>So, how can I avoid this? It there something I should put in my model definition? Or should I avoid <code>find_each</code> and use a different method? This is a for a rake task that just goes through all the entries and looks up some additional information...</p>