Rails provides a number of extensions to core Ruby classes. One of these is the to_sentence method, added to the Array class, allowing for the following:
['a', 'b', 'c'].to_sentence # gives: "a, b, and c"
I would like to extend this method to allow it to take a block, so that you can do something like the following (where people is an array of Person objects, which have the name attribute):
people.to_sentence { |person| person.name } # give something like: "Bill, John, and Mark"
I don't have a problem with writing the extension method. But I can't work out where to put it.
The Rails core extensions get loaded somewhere down in the depths of ActiveSupport.
My need is for a place where user-defined code is always loaded, and is pre-loaded (before any application code).