If I add a class to ./lib, the class is created and I can access it on
script/console.
However, if I extend a (core) class using a file in lib, the class
extension does not occur. The methods I want to add do not appear.
If I explicitly load the class, the methods get added. But they are
not done automatically like with other things in lib. Why?
Or, more to the point: What is the correct Rails way to add a method
to a core Ruby class?
For extending core classes you've got the main one right there. One
thing to keep in mind is that files are only read out of /lib at
startup... that is when you first fire up the console or Rails
webserver. If you make changes to the file you'll have to reload! (in
console) or restart the webserver.