Class: Eql::Adapters::ActiveRecord
- Defined in:
- lib/eql/adapters/active_record.rb
Overview
ActiveRecord class is a ActiveRecord::Base adapter
Defined Under Namespace
Modules: ContextHelpers
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#conn ⇒ ActiveRecord::ConnectionAdapters::AbstractAdapter
Get DB connection to execute a query.
- #execute ⇒ Object
- #extension ⇒ Object
-
#sql ⇒ Stirng
Get rendered SQL.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Eql::Adapters::Base
Class Method Details
.match?(conn) ⇒ Boolean
26 27 28 29 |
# File 'lib/eql/adapters/active_record.rb', line 26 def self.match?(conn) defined?(::ActiveRecord::Base) && conn.is_a?(::ActiveRecord::ConnectionAdapters::AbstractAdapter) end |
Instance Method Details
#conn ⇒ ActiveRecord::ConnectionAdapters::AbstractAdapter
Get DB connection to execute a query
59 60 61 |
# File 'lib/eql/adapters/active_record.rb', line 59 def conn builder.conn || ::ActiveRecord::Base.connection end |
#execute ⇒ Object
50 51 52 |
# File 'lib/eql/adapters/active_record.rb', line 50 def execute conn.execute(sql).to_a end |
#extension ⇒ Object
43 44 45 |
# File 'lib/eql/adapters/active_record.rb', line 43 def extension '.{sql.erb,erb.sql}' end |
#sql ⇒ Stirng
Get rendered SQL
36 37 38 |
# File 'lib/eql/adapters/active_record.rb', line 36 def sql builder.render end |