views:

112

answers:

1

I'm parsing a csv file and trying to send it to a table with fewer fields than the original csv file. How do I remove those extraneous commas that are left over if I set the extra fields to nothing?

Here's the original csv format:

columns => id,first_name,last_name,phone,fax
sample row => 1,ben,tomas,5555555,6666666

Here's the final format:

column => id,phone,fax
sample row => 1,5555555,6666666

Notice the missing commas for the first and last name.

Here's the tentative row processor:

module ETL 
  module Processor
    class PhoneProcessor < ETL::Processor::RowProcessor

  def process(row)
    #debugger
    row = {:id => row[:id], 
           :phone => row[:phone], 
           :fax => row[:fax]}
    row
  end
end
end
end
A: 

After sending an email to the gem's mailing list and waiting a few weeks I've concluded the gem is either dead or I'm using it in a way that it was not intended to be used. Weak answer, but that's all I got.

P.S. Decided to just make activerecord models and go from there.

btelles