Proper Location for AR Monkey-Patch (Rails 3)

I’m trying to monkey patch active record (and more specifically the
MySQL
connection adapter) for a rails 3 app. Here is my attempt:

https://gist.github.com/849849

It doesn’t work. When I try to “rake db:migrate” or open a rails console
or
otherwise load the app, I get the following error:

…/gems/activesupport-3.0.3/lib/active_support/core_ext/module/aliasing.rb:31:in
alias_method': undefined method value_to_boolean’ for class
`ActiveRecord::ConnectionAdapters::Column’ (NameError)

So, clearly the active record classes (and/or these specific
classes/parts
of active record) aren’t loaded when this initializer runs. So, my
question
is, given what I’m trying to do, what is the correct or most common way
to
do this kind of monkey patching? I’m not familiar with the rails 3 way
of
things but remember hearing/reading a lot about a more standardized way
(API) for configuring/patching/tweaking rails. Is there an idiomatic way
to
do this properly and at the right time in the application load sequence
(so
I don’t have to have my initializer force-preload these AR classes)?

Thanks in advance for any input!

Okay, I did an edit of my linked monkey-patch. I can do a “rake
db:migrate”
and start a rails console now. I fixed on obvious bug I had. However,
I’m
forced to manually include the mysql adapter in my initializer for it to
work. So, my overall question still stands… what is the correct
idiomatic
way of doing this?

Side note: though I can now run my migration(s) and load a console, the
database table created with my migration doesn’t seem to reflect my
monkey-patching (yes, I did a complete “rake db:drop” first). In other
words, if anyone also has more specific pointers (not just how/where to
monkey-patch like this, but how to accomplish my specific goal) I’d sure
welcome them. Just so you know, I’m trying to force the AR/MysqlAdapter
to
use “-1” for boolean true values and the MySQL “TIMESTAMP” type for
:timestamp-typed columns.

Thanks again.