what if I want
to make a simple class or global func to be available to the entire
app? Is there a specific Rails way to do it?
It depends on where you need to use this code.
If it’s a view method, helpers/application_helper.rb is the place.
If you have a class that is used by other code then you need to put
that into lib/. For example, if you had a class that encrypts data,
you might create a class called ‘Encryptor’ and put it in
lib/encryptor.rb. If you’re using <Rails 1.2, then you need to add an
include to config/environment.rb to pull that class in. As of Rails
1.2, this is done for you when the class is called.
If you have a method that is used by all controllers, then you can
put it in application_controller.rb, but you should think about whether
it belongs there or should really be in a helper or separate utility
Hope that helps,