Forum: Ruby on Rails shared methods for controllers belonging to a specific modul

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.
rails.list (Guest)
on 2005-12-03 04:31
(Received via mailing list)
Hi everyone.

I was just wondering what the best way â?¢ might be to let all controllers
of a module share methods and variables. Is there some "magic" file
rails will automatically load when a module is requested or do I have to
manually (doesn't sound like the rails way..) create a class with the
desired methods/variables and let my controllers inherit from it? If so,
where to put that file in order to let rails do some autoload magic?

petermichaux (Guest)
on 2005-12-03 08:03
(Received via mailing list)
I was asking about the same thing but for models instead of controllers.
was told to put the shared code in a Ruby module in a file in the lib
directory and then include the module in the desired model. The files in
lib directory seem to be loaded and available automatically. But I have
restart WEBrick each time I change a file in lib/.

This topic is locked and can not be replied to.