Rails Truncating "TEXT" values to 255 characters

Hello!

Let me see if this is somehow easy. I have columns in my MySQL database set as 'text' ( double checked, they're not accidentally set to the wrong thing). I'm trying to Marshal some data for a special need in the program. Whenever I save this, though, the data (ie the resulting string after marshal) gets chopped to no more than 255 characters. Has there ever been an issue with MySQL doing that or maybe rails thinking it's the wrong type?

I managed to fix it by converting the text fields to 'blob' data types, but it's still weird and I'd love to know why.

-Ryan

def matchattributes self[:matchattributes] ? Marshal.load(self[:matchattributes]) : end def matchattributes=(x) self[:matchattributes] = Marshal.dump(x) end

Hello!

Let me see if this is somehow easy. I have columns in my MySQL database set as 'text' ( double checked, they're not accidentally set to the wrong thing). I'm trying to Marshal some data for a special need in the program. Whenever I save this, though, the data (ie the resulting string after marshal) gets chopped to no more than 255 characters. Has there ever been an issue with MySQL doing that or maybe rails thinking it's the wrong type?

Use a blob rather than a text column - if you've got a text column with the encoding set to utf8 (often to default) mysql will truncate when it sees data that isn't valid utf8

Fred