Wednesday, May 13, 2009

Fix for ruby 1.8.7 incompatibity

by Sandip Ransing 0 comments
Tags

Last week i moved from ruby version 1.8.6 to 1.8.7.
then over a week i found that my 1.2.3 and applications developed in ruby 1.8.6 are not working in ruby 1.8.7.

From lot of search on google, i found that its issue with ruby 1.8.7.

Then, i started searching fix / solution for this incompatibity.
And, Finally i got solution.

We just need to fix file delegate.rb
here is fix

Diff of /branches/ruby_1_8_7/lib/delegate.rb

--- branches/ruby_1_8_7/lib/delegate.rb 2008/05/31 15:17:53 16732
+++ branches/ruby_1_8_7/lib/delegate.rb 2008/06/02 10:52:07 16756
@@ -163,9 +163,9 @@
# Checks for a method provided by this the delegate object by fowarding the

# call through \_\_getobj\_\_.
#
- def respond_to?(m)
+ def respond_to?(m, include_private = false)
return true if super
- return self.__getobj__.respond_to?(m)
+ return self.__getobj__.respond_to?(m, include_private)

end

#
@@ -270,9 +270,9 @@
end
@_dc_obj.__send__(m, *args)
end
- def respond_to?(m) # :nodoc:
+ def respond_to?(m, include_private = false) # :nodoc:
return true if super

- return @_dc_obj.respond_to?(m)
+ return @_dc_obj.respond_to?(m, include_private)
end
def __getobj__ # :nodoc:
@_dc_obj

You have to make necessary changes and you are ready to work with ruby 1.8.7.
need not downgrade ruby version :)

for Hash error

Add following line in config/environment.rb
unless '1.9'.respond_to?(:force_encoding)
String.class_eval do
begin
remove_method :chars
rescue NameError
# OK
end
end
end


Cheers !

Sandip

blog comments powered by Disqus

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter