Getting hard-drive data into a Rails app: Pre-loading DB table[s] works; how about file access?

Hi,

I'm writing a Bridge (card game) tester for myself and my partner in order to improve our bidding. I don't feel like writing a bunch of SQL Inserts. I could write a Ruby formatter to take data in the format I like and generate the SQL. Then I'd run feed that file to the DBMS. That'd be OK.

I'd like it better if I could simply open my file in a controller and, for each data line, populate a set of attributes of a new model instance. Is this feasible? Is there a public example of how this would be coded?

Thanks in Advance, Richard

Hi,

I'm writing a Bridge (card game) tester for myself and my partner in order to improve our bidding. I don't feel like writing a bunch of SQL Inserts. I could write a Ruby formatter to take data in the format I like and generate the SQL. Then I'd run feed that file to the DBMS. That'd be OK.

I'd like it better if I could simply open my file in a controller and, for each data line, populate a set of attributes of a new model instance. Is this feasible? Is there a public example of how this would be coded?

Hi Craig,

NameBright - Coming Soon

Perfect answer! Many thanks.

Best wishes, Richard