Created
December 14, 2011 23:03
-
-
Save wreimers/1478997 to your computer and use it in GitHub Desktop.
A Rails 3.1 initializer to monkeypatch the mysql2 AR adapter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.connection.execute("SELECT 1") | |
module ActiveRecord | |
module ConnectionAdapters | |
class Mysql2Adapter | |
def create_table(table_name, options = {}) | |
super(table_name, options.reverse_merge(:options => "ENGINE=ndbcluster")) | |
end | |
end | |
end | |
end |
where shall I put the monkey patch script , make rails load it properly ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why the fake db call you ask? So Rails 3.1 initializes the adapter properly before I patch it. If you simply 'require' the module, it bails out later as it is not initialized properly.