lib/search_cop/visitors/visitor.rb in search_cop-1.0.9 vs lib/search_cop/visitors/visitor.rb in search_cop-1.1.0
- old
+ new
@@ -5,11 +5,11 @@
attr_accessor :connection
def initialize(connection)
@connection = connection
- extend(SearchCop::Visitors::Mysql) if @connection.class.name =~ /mysql/i
- extend(SearchCop::Visitors::Postgres) if @connection.class.name =~ /postgres/i
+ extend(SearchCop::Visitors::Mysql) if @connection.adapter_name =~ /mysql/i
+ extend(SearchCop::Visitors::Postgres) if @connection.adapter_name =~ /postgres|postgis/i
end
def visit(visit_node = node)
send "visit_#{visit_node.class.name.gsub(/::/, "_")}", visit_node
end