Niels Ganser
2005-Dec-03 02:31 UTC
shared methods for controllers belonging to a specific module
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.
Peter Michaux
2005-Dec-03 06:00 UTC
Re: shared methods for controllers belonging to a specific module
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 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Maybe Matching Threads
- [ActiveRecord::Base].collect {|a,b| ...} weirdness
- [scriptaculous] scroll down to show full auto completion list (w/ possible patch)
- Parsing output, separating motd and module-list
- centile reference chart / clildren growth chart - what package/method to use
- Verification: Module methods being called from controller