Skip to content
Browse files

Dont' redefine select on the mysql adapter if it has already been red…

…efined
  • Loading branch information...
1 parent 8836d7e commit 8e214da4da11c32059b17f086d8ccc053d7ff58e @smtlaissezfaire committed Jan 5, 2009
Showing with 6 additions and 4 deletions.
  1. +6 −4 init.rb
View
10 init.rb
@@ -1,10 +1,12 @@
require File.dirname(__FILE__) + "/lib/enhanced_query_analyzer"
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
- public :select
- alias_method :old_select_aliased_by_query_analyzer, :select
+ unless defined?(:old_select_aliased_by_query_analyzer)
+ public :select
+ alias_method :old_select_aliased_by_query_analyzer, :select
- def select(sql, name = nil)
- EnhancedQueryAnalyzer.select(self, sql, name)
+ def select(sql, name = nil)
+ EnhancedQueryAnalyzer.select(self, sql, name)
+ end
end
end

0 comments on commit 8e214da

Please sign in to comment.
Something went wrong with that request. Please try again.