Forum: Ruby on Rails Modules 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.
Joe C. (Guest)
on 2006-05-31 01:46
Hi,  I have a module in the /myApp/lib directory to help manage image
files.  It is coincidentally called 'image_manager'.

There is a function in there called asset_path, which is used to
determine the path of the images that is defined as follows:
  def asset_path

I am including the image manager module in the model for the image, but
when I call this function I get the following error:
undefined local variable or method `foo' for #<Album:0x39b0d70>

"foo" is a function I have in my application controller and helper, and
is defined as follows:
  def foo

Apparently the module can't see the methods in the application
controller and helper.  Is there some other way the module in 'lib' can
get at the object I have in my session?
This topic is locked and can not be replied to.