Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rails 3.2 monkey-patch to enable Mysql strict mode by default
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