Class: SQLRewriter::Adapters::ActiveRecord
- Inherits:
-
Object
- Object
- SQLRewriter::Adapters::ActiveRecord
- Defined in:
- lib/sql-rewriter/adapters.rb
Defined Under Namespace
Modules: Decorator Classes: Railtie
Class Method Summary collapse
-
.inject ⇒ Object
Most of this code is lifted from the Marginalia gem.
Class Method Details
.inject ⇒ Object
Most of this code is lifted from the Marginalia gem
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sql-rewriter/adapters.rb', line 8 def self.inject if defined? ::ActiveRecord::ConnectionAdapters::Mysql2Adapter if ::ActiveRecord::Base.connection.is_a?( ::ActiveRecord::ConnectionAdapters::Mysql2Adapter) ::ActiveRecord::ConnectionAdapters::Mysql2Adapter.module_eval do include SQLRewriter::Adapters::ActiveRecord::Decorator end end end if defined? ::ActiveRecord::ConnectionAdapters::MysqlAdapter if ::ActiveRecord::Base.connection.is_a?( ::ActiveRecord::ConnectionAdapters::MysqlAdapter) ::ActiveRecord::ConnectionAdapters::MysqlAdapter.module_eval do include SQLRewriter::Adapters::ActiveRecord::Decorator end end end # SQL queries made through PostgreSQLAdapter#exec_delete will not be annotated. if defined? ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter if ::ActiveRecord::Base.connection.is_a?( ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.module_eval do include SQLRewriter::Adapters::ActiveRecord::Decorator end end end if defined? ::ActiveRecord::ConnectionAdapters::SQLite3Adapter if ::ActiveRecord::Base.connection.is_a?( ::ActiveRecord::ConnectionAdapters::SQLite3Adapter) ::ActiveRecord::ConnectionAdapters::SQLite3Adapter.module_eval do include SQLRewriter::Adapters::ActiveRecord::Decorator end end end end |