Your application's "lib" directory will be in the Ruby load path and by
default, when Rails comes across something starting with a capital
letter it will "require" a file of the lower cased name (with words
separated by underscores). This all means that, if you place a class
MyClass in the file lib/my_class.rb then it will automatically be loaded
when it is needed. This is the usual place to put classes which are not
ActiveRecord models. You can then access this class from any model,
view or controller code.
--
Posted via http://www.ruby-forum.com/.
Yes. Rails relates subdirectories to namespaces. For example, you
could have the class Admin::Something in the file lib/admin/something.rb
and Rails will find it automatically.
If you want to put classes into subdirectories without namespaces then
you need to tell Rails where to find the class definitions using
"require".
No, you'll have to load it in elsewhere, such as your
config/environment.rb file.