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’

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

60 module Mymodule
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”

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

On Feb 29, 5:30pm, John L. [email protected] wrote:

know what.

require “openssl”
=> true

module Foo
| include OpenSSL::Cipher
| end
TypeError: wrong argument type Class (expected Module)
(ripl):5:in include' (ripl):5:inmodule:Foo
(ripl):4:in `’

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

Luis L.

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…

Do you know if the definition of openssl:cipher has changed at all ? Did
it used to be a module but is now a class?

Interesting… just found this:
I will spend a little time tomorrow investigating more…

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs