Forum: Ruby on Rails code in the lib directory

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
A691815a08c9f9737e0dc3ac7abf898c?d=identicon&s=25 sigsegv (Guest)
on 2007-02-24 11:20
(Received via mailing list)

I've put code very similar to the following code in the lib directory.

module Common
  A_CONSTANT = [ 'one', 'two', 'three', 'four' ]

  def a_method(session)
    if !session[:d] then
      session[:d] = 'a string constant'
    ... more of the same ...

The file containing this code is named 'common.rb'.  The constant and
method are then referenced in a number of my controllers similar to
the following:

class MyController ...
  def index
    some_variable = Common::A_CONSTANT

When the app is run, ruby/rails is able to resolve the A_CONSTANT
reference, but I can't seem to get the method to resolve.  I've tried
using require in the controller files, I've tried delimiting the
method with double colons and I've tried different names for the
module while making sure the file and module names in sync.  What am I
doing wrong?
This topic is locked and can not be replied to.