Pius, I looked at the CSV type, but it looks like its use case is comma-separated values within a field as part of a larger structure. What I'm looking for is an interface where I can have one model property per field in a CSV file. I'd like the application to be datastore-agnostic so it can handle a CSV file or a database just by changing the adapter it's using. I can't think of a way to do that with the CSV serializer type. Any thoughts?
Earle Pius Uzamere wrote: > Hi Earle, > > For some reason, my responses keep getting bounced from the DataMapper list. > > On first blush, it sounds to me as if you need a "Type" rather than an > "Adapter." The good news is there's an existing DataMapper CSV type > that comes with the DM-Types gem. > > About > DM-Types:http://datamapper.org/doku.php?id=dm-more:dm-types&s[]=types > <http://datamapper.org/doku.php?id=dm-more:dm-types&s%5B%5D=types> > Implementation of the CSV Type: > http://github.com/sam/dm-more/blob/e7c030a100acd4f6029daed8f42dd1b517cf0adc/dm-types/lib/dm-types/csv.rb > > Cheers, > Pius > > **** > > > I've looked around for a CSV adapter, but haven't had any luck. So I'm > thinking about writing my own. Basically, it > would be a wrapper around FasterCSV. One issue that is (I think > uniquely) important with CSV files is the field order. > I'm thinking of using a :field_index property option to identify field > order. One other option might be to use the > order of property declaration to determine field order. I'm also > considering a :field_name option to identify the field > name in the header row, if any. Does anyone have any thoughts on these > items or general thoughts about what a CSV > adapter ought to look like/do? > > If anyone has done any work in this area, pointers are welcome. > > Earle --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
