Hey all! I am about to start drawing outside the lines for the first time, and I had a strange question. I have been following the rails conventions outlined in my readings and tutorials. I am now working on creating a new import feature for my application. The user will upload a PDF which will call a script that converts it to a text file. I have the command line application that will do the conversion, but it is my job to start parsing the output into meaningful data that will be placed in my database. So after spending some time with my nose buried in Ruby books, I feel more then ready to tackle the new challenge, the weird thing is . . . where does this code go? I am going to write a long ruby script that takes the text data and maps it out using regular expressions to get the matched up with it's correct labels . . . and I would like to have my own models around to store the data in. but it seems like writing the whole thing in one of my controllers or models doesn't seem like the "right" place. While the script is running it is going to be saving data to my app's database, and upon completion needs to return some information to my app for further processing. Would anyone mind pointing me in the right direction? Thanks ahead of time!
on 2008-11-20 00:56
on 2008-11-20 01:37
On Nov 19, 11:56 pm, Mark Bush <rails-mailing-l...@andreas-s.net> wrote: > placed in my database. So after spending some time with my nose buried > further processing. Would anyone mind pointing me in the right > direction? > You're instinct to not want it in a controller is good. I personally would have it in a model. That model (the DataImporter or whatever you want to call it) probably wouldn't be a subclass of ActiveRecord::Base but that's fine. You could put the corresponding file in the lib folder if you don't like app/models containing non databasey stuff. Fred