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! -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-20 00:37 UTC
Re: First time stepping out of bounds, where does my code go?
On Nov 19, 11:56 pm, Mark Bush <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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? >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> Thanks ahead of time! > -- > Posted viahttp://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---