OpenSSL on rails 2

Hi list,

It's been a while since I looked at rails and I am a but rusty. I'm looking for a nudge in the right direction if anyone would be so kind to help me.

I'm looking at something I did a few years back that I need to review and upgrade. The last time I looked at this we were on Rails 2.0.2 so that's what this code is for. So I am trying to get it running on that environment to start off.

I have a RVM environment running rails 2.0.2 on ruby 1.8.7. I can run my application but I get an error like the below.

wrong argument type Class (expected Module)

Application Trace | Framework Trace | Full Trace

lib/mymodule.rb:65:in `include' lib/mymodule.rb:65 app/controllers/application.rb:8

The code snippet referred to is a module of the form:

60 module Mymodule 61 62 require 'openssl' 63 include OpenSSL 64 include PKey 65 include Cipher

So I suspect I have something wrong with my OpenSSL in rvm, but I don't know what.

This code worked fine the last time I looked at it. The module is mixed in to a controller.

I tried the below to test if openssl is available:

$ ruby -ropenssl -e "puts :Hello" Hello

I would appreciate any pointers I can get to help me get started...

Hi list,

wrong argument type Class (expected Module)

Application Trace | Framework Trace | Full Trace

lib/mymodule.rb:65:in `include' lib/mymodule.rb:65 app/controllers/application.rb:8

The code snippet referred to is a module of the form:

60 module Mymodule 61 62 require 'openssl' 63 include OpenSSL 64 include PKey 65 include Cipher

So I suspect I have something wrong with my OpenSSL in rvm, but I don't know what.

require "openssl"

=> true

module Foo

include OpenSSL::Cipher end

TypeError: wrong argument type Class (expected Module)     (ripl):5:in `include'     (ripl):5:in `<module:Foo>'     (ripl):4:in `<main>'

You're trying to include a class into a module, OpenSSL::Cipher is a class while PKey and OpenSSL itself is a module.

Yeah but I am sure this did work before. It's been on a web site for quite some time and has been working. If what you're saying is right then I'll have to look to see if somehow my sources have been broken...

Ok, Success. with rails 1.8.6 - it works just fine. So something was changed between ruby 1.8.6 and 1.8.7 which introduced this "Cipher is not a module" problem.