Save data to blob

Hi, folks,

I have a “data” field that is defined as “blob” in model file. However,
it always fails when I try to save a larger file … in this case, the
so-called larger is merely 200K around. Do I need to do anything
special to be able to save it (the file can be text or binary).

Mysql::Error: #22001Data too long for column ‘data’ at row 1: INSERT
INTO works (name, tag_id, data, email) VALUES(‘test102’, 0,
x’255044462d…

Thanks

Oliver

On 2006-09-20, at 14:03 , Oliver wrote:

I have a “data” field that is defined as “blob” in model file.
However,
it always fails when I try to save a larger file … in this case, the
so-called larger is merely 200K around. Do I need to do anything
special to be able to save it (the file can be text or binary).

Blobs are way too much trouble to deal with. Any reason why you can’t
store the blobby data in an external file?

hmm … I suppose it can be external file, since I am new to rails. I
just thought with ActiveRecord in the middle, I could deal with all
fields in a uniform way.

Is storing external file a more recommended practice? then the
directory layout and naming become an issue to deal with when you have
many files. Any pointer on how is it supposed to be done?

Thanks for the reply.

Oliver

On 2006-09-20, at 14:29 , Oliver wrote:

Is storing external file a more recommended practice? then the
directory layout and naming become an issue to deal with when you have
many files. Any pointer on how is it supposed to be done?

There’s a plugin called file_column.

Sorry I can’t give you more details, I have no experience with it,
for I’ve been using my own solution since before file_column was
around. (and my own solution is not ready for public consumption,
otherwise I’d gladly recommend it)