Monkeypatch for rubyforge gem’s “error occurred while evaluating nil.tmp_dh_callback=”

This is the way to get rid of ‘nil.tmp_dh_callback=’ bug by using Rails plugin. Whenever they fix this in rubyforge gem – simply remove the plugin directory from vendor/plugins.

cd rails_app/vendor/plugins
mkdir rubyforge_patch
cd rubyforge_patch
mate init.rb

Paste this into init.rb

require 'net/http'

class Net::HTTP
  def use_ssl= flag
    self.old_use_ssl = flag
    @ssl_context.tmp_dh_callback = proc {} if flag
  end
end if Net::HTTP.public_instance_methods.include? "old_use_ssl="

That’s it. You’re good to go. No more nil.tmp_dh_callback error.

4 responses to “Monkeypatch for rubyforge gem’s “error occurred while evaluating nil.tmp_dh_callback=””

  1. Tadd Giles

    Thanks! This saved me some headaches tonight.

    Minor nits on the instructions: 1) remove the ’s’ in vendors and 2) add a “cd rubyforge_patch” cmd after the mkdir command.

    Thanks again! Very helpful.

  2. poker

    Thanks really works, no more headaches.

  3. Anonymous

    Great patch. Thanks.

    An alternate place to put the code would be in config/initializer/rubyforge_patch.rb.

Leave a Reply