I’m trying to monkey patch active record (and more specifically the MySQL connection adapter) for a rails 3 app. Here is my attempt:
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:
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!