Just FYI: Rails 2.3.14 is not Ruby 1.9.2 compatible.

Just a quick heads up for everyone.

Rails 2.3.14 is not completely Ruby 1.9.2 compatible.

Specifically the vendored version of TMail in ActionMailer calls String#is_binary_data?. This method was removed from Ruby in 1.9.2.

I realize that this probably won't be fixed as Rails 2.x is EOL, but I'm just putting it out there in case other people run into the problem. Personally I'd advocate a fix, Rails 2.3 promised Ruby 1.9 compatibility and this breaks that promise.

A simple workaround is to copy the definition of the method forward and add it to the String class in an initializer.

Here is it for reference (copied from apidock.com)

def is_binary_data?   (self.count("^ -~", "^\r\n\").fdiv(self.size) > 0.3 || self.index("\x00")) unless empty? end

Andrew

Worth fixing. Please give 1.9.3 a shot too. Even if we don’t do a gem release, folks can target the 2-3-stable branch.

The method doesn't exist in 1.9.3 either, so that will blow up as well.

Well, the method actually exists in both Ruby 1.9.2 and 1.9.3. Syck freedom patched string to add the method:

  https://github.com/ruby/ruby/blob/trunk/ext/syck/lib/syck/rubytypes.rb#L151-153

If you load Psych before loading Syck, this method will not exist on String because Syck will never be loaded. There are three ways to work around this without changing Rails. First would be to require 'syck/rubytypes':

    [aaron@higgins rails (master)]$ irb     irb(main):001:0> "foo".respond_to?(:is_binary_data?)     => false     irb(main):002:0> require 'yaml'     => true     irb(main):003:0> require 'syck/rubytypes'     => true     irb(main):004:0> "foo".respond_to?(:is_binary_data?)     => true     irb(main):005:0>

I don't recommend this solution because it can impact YAML dumping and loading. The second solution would be to freedom patch the method yourself:

    class String       def is_binary_data?         encoding == Encoding::ASCII_8BIT       end     end

I recommend this solution.

The third solution is to downgrade Rubygems. It's likely rubygems is the one loading in Psych before Syck. But it could also be bundler. It could be many things, so I don't suggest this solution.

<3<3<3