Saturday, July 7, 2012

Re: [Rails] Problem processing text file after uploading

On Sat, Jul 7, 2012 at 8:11 AM, David M. <lists@ruby-forum.com> wrote:

> Currently the model handles those files, saves some metadata (the
> extention and orig filename) then saves the file to the hard drive. Next
> it converts the doc and docx files to plain text and saves the output to
> a txt file.
>
> My problem is I want to copy the plain text contents of those txt files
> to the :body field in my database, but by the time those files are
> written no more changes can be sent to the data base (because all the
> file handling is done in after_save)

Wouldn't the obvious answer be to do the file handling in before_save?

And is there a reason to write the text to a file in the first place if you're
just going to save it in the DB?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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@googlegroups.com.
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-US.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate