Created
July 22, 2011 14:46
-
-
Save wireframe/1099601 to your computer and use it in GitHub Desktop.
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
| module ActiveRecord::ConnectionAdapters::DatabaseStatements | |
| def select_all_with_explain_plan(sql, name = nil) | |
| missing_indexes = select_all_without_explain_plan("EXPLAIN #{sql}", "explain plan").reject {|r| r['key'] } | |
| raise "Missing dataabase indexes: #{missing_indexes.inspect}" if missing_indexes.any? | |
| select_all_without_explain_plan(sql, name) | |
| end | |
| alias_method_chain :select_all, :explain_plan | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment