What is the right way to monkey patch rails?

Hi --

I need to change a little method in rails, specifically the
authorization method in ActionController::HttpAuthentication::Basic
(which uses a fixed list of authentication env locations that doesn't
include what my server does).

Right now the way i do it is i have at the end of my application.rb file

module ActionController::HttpAuthentication::Basic
def authorization
   #code here...
end
end

Is there a better way of doing it?

(Written under protest, because you're making me respond to the
loathsome phrase "monkey patching" :slight_smile:

Off-hand it looks to me like that might be happier living in the
config/initializers directory, assuming you're using 2.0 and that
putting it there would have the same effect. It feels a bit buried in
application.rb, whereas if it were in its own file in initializers, it
would be more on the surface of the code and easier to find and/or
notice.

David