Created
July 2, 2012 08:32
-
-
Save mikhailov/3031943 to your computer and use it in GitHub Desktop.
Rails 3.2 monkey-patch to enable Mysql strict mode by default
This file contains hidden or 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
class ActiveRecord::ConnectionAdapters::Mysql2Adapter | |
private | |
alias_method :configure_connection_without_strict_mode, :configure_connection | |
def configure_connection | |
configure_connection_without_strict_mode | |
strict_mode = "SQL_MODE='STRICT_ALL_TABLES'" | |
execute("SET #{strict_mode}", :skip_logging) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment