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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Jeremy Kemper
2011-Dec-23 19:50 UTC
Re: Just FYI: Rails 2.3.14 is not Ruby 1.9.2 compatible.
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. On Fri, Dec 23, 2011 at 12:20 PM, Andrew Selder <andrew.selder@gmail.com>wrote:> 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Andrew Selder
2011-Dec-23 20:05 UTC
Re: Just FYI: Rails 2.3.14 is not Ruby 1.9.2 compatible.
The method doesn''t exist in 1.9.3 either, so that will blow up as well. On Dec 23, 11:50 am, Jeremy Kemper <jeremykem...@gmail.com> wrote:> 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. > > On Fri, Dec 23, 2011 at 12:20 PM, Andrew Selder <andrew.sel...@gmail.com>wrote: > > > > > > > > > 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 > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > To unsubscribe from this group, send email to > > rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Aaron Patterson
2011-Dec-24 00:17 UTC
Re: Re: Just FYI: Rails 2.3.14 is not Ruby 1.9.2 compatible.
On Fri, Dec 23, 2011 at 12:05:55PM -0800, Andrew Selder wrote:> The method doesn''t exist in 1.9.3 either, so that will blow up as > well. > > On Dec 23, 11:50 am, Jeremy Kemper <jeremykem...@gmail.com> wrote: > > 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. > > > > On Fri, Dec 23, 2011 at 12:20 PM, Andrew Selder <andrew.sel...@gmail.com>wrote: > > > > > > > > > > > > > > > > > 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 > > > > > AndrewWell, 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 -- Aaron Patterson http://tenderlovemaking.com/