Is there any particular reason that you wrote the script as an
external command instead of simply write that code as a class that you
can call your parsing methods on?
class AttachmentParser
def parse(file)
...your parsing code here...
end
end
You could put this class either in a directory where Rails will load
it automatically or you can require it wherever you want to do your
parsing.
On Jul 23, 8:08 pm, Blakes
<itsblakeith...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I have been working on an application that takes a text file and
> parses information from it. I have the script in my script folder,
> and can run it if I enter ''script/parser file.txt''. I am
using the
> ''attachment_fu'' plug-in to upload the text file to my
public folder
> (admittedly not the best place to keep raw data, but I will work that
> out in time). Once I have that file uploaded, and verified it using
> the ''validates_as_attachment'', how do I get the script to
> automatically parse the file?
>
> Would it be possible to create a helper that runs a console command?
> It seems possible, but not the best way. Does anyone have a better
> idea?
>
> Thank you so much for any help you can give. I have been racking my
> brain trying to figure this out.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---