Shared methods for controllers belonging to a specific modul

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?


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 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