title: Read stored file line by line in postgresql carrierwave
body: <p>I am using <a href="https://github.com/diogob/carrierwave-postgresql" rel="nofollow">carrierwave-postgresql</a> to store user uploaded files.</p>
  
  <p>I have an uploader called FileUploader (in /app/uploaders/file_uploader.rb) with <code>storage :postgresql_lo</code>.</p>
  
  <p>The uploaded files are linked to a column <code>:file_oid</code> in a model called UploadedFile (in app/models/uploaded_file.rb) with <code>mount_uploader :file_oid, FileUploader</code>:</p>
  
  <pre><code>class UploadedFile &lt; ActiveRecord::Base
    attr_accessible :file_oid, :processed, :type
    mount_uploader :file_oid, FileUploader
  end
  </code></pre>
  
  <p>I upload a file as</p>
  
  <pre><code>f = UploadedFile.new
  f.file_oid = params[:flat_file]
  f.save!
  </code></pre>
  
  <p>Now when I try to read a file, the <code>read</code> method works fine, but I can't get an 'each' or 'open'.</p>
  
  <pre><code>&gt; uf = UploadedFile.find(:first)
  &gt; uf.file_oid.read # works, gives the contents of the file
  &gt; uf.file_oid.file.read # this works too
  &gt; uf.file_oid.file.each
  NoMethodError: undefined method `each' for #&lt;CarrierWave::Storage::PostgresqlLo::File:0x000000039157a0&gt;
  &gt; uf.file_oid.file.open
  NoMethodError: private method `open' called for #&lt;CarrierWave::Storage::PostgresqlLo::File:0x000000039157a0&gt;
  &gt; uf.file_oid.open
  NoMethodError: private method `open' called for /uploadedfile_file_oid/231132:FileUploader
  </code></pre>