On Nov 26, 8:51 am, kopf1988 <[email protected]> wrote:
> 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
>
> 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

--

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to