Shared methods for controllers belonging to a specific modul


#1

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?

Regards,
Niels.


#2

I was asking about the same thing but for models instead of controllers.
I
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
the
lib directory seem to be loaded and available automatically. But I have
to
restart WEBrick each time I change a file in lib/.

Peter