How to use Chars in classes not derived from AR

Hi!

I have a class that derives from nothing and is located in /models. I'm using " my string ".chars to manipulate strings that potentially contain special chars and replace them with an US-ASCII equivalent.

It did work until yesterday. Now on a linux system "a".chars returns #<Enumerable::Enumerator:0xb74e3d6c>

While it should return #<ActiveSupport::Multibyte::Chars:0xb74e1bc0 @string="a">

(the class is contained in active_support/multibyte/chars.rb)

Therefore the whole app crashes because Enumerable does not have methods like "downcase" or "'a'.chars[0]" which can handle UTF-8 chars as well. Using it w/o UTF-8 support ends up in a mess.

Any ideas? How could I require or include "ActiveSupport::Multibyte::Chars"? Any tests have been negative so far.

regards David

Hi!

I have a class that derives from nothing and is located in /models.
I'm using " my string ".chars to manipulate strings that potentially
contain special chars and replace them with an US-ASCII equivalent.

It did work until yesterday. Now on a linux system "a".chars returns #<Enumerable::Enumerator:0xb74e3d6c>

While it should return #<ActiveSupport::Multibyte::Chars:0xb74e1bc0 @string="a">

Have you just upgraded to ruby 1.8.7 by any chance? Are you running
rails 2.1 ? versions < 2.1 aren't ready for 1.8.7 IIRC.

Fred

Yes, that's it. I've just checked on another linux server that is running with Ruby 1.8.6.144-2 and a vulnerable openssl version. And it still works there.

It might be connected to the different ruby version. I'm trying to downgrade now.

This did not solved the problem so far.

Any experiences or ideas regarding this issue?

Thanks David

Finally it did.

I've just forgot to undo the changes I did while I was trying to fix it by myself.

k Thanks!

Any rumors why this happens that often, or why this particular packages is causing this issue?

I've already experienced it several times that our rails application was broken after upgrading a gem or rails specific deb-package.

Regards David