On Dec 19, 2008, at 3:26 PM, Corey Murphy wrote: > Rob Biedenharn wrote: >> However, it looks like your input is CSV so why not let a CSV library >> do the heavy-lifting for you: > > Primarily because this is a budget application I'm writing and the > data > coming from Accounts Payable (.csv files) need to be read in and then > massaged some before moving it into the database. A lot of the > massaging relates to categorizing transactions and associating other > information with a record that isn't a part of the original input > file. > So, I'm manually parsing this data into an array for active record > column attribute assignment and the like. > > Unless fasterCSV reads a file in for me and give me the data in an > array > I can use in my model or controller for further processing, it doesn't > fit my needs. So forgive my ignorance if it does do this and I'm > simply > not aware. However, if it does, then woohoo and I'll be pulling down > the gem pronto.
Then start now! gem install fastercsv I was just using one of the lower-level methods to parse your input line. I'll let you read the docs[1] for yourself, but it will read the file and give the data back to you as an array or a hash (you choose). You can configure whether there are first-row headers, too. -Rob [1] http://fastercsv.rubyforge.org/ Rob Biedenharn http://agileconsultingllc.com r...@agileconsultingllc.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---