Class: Motor::Query
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Motor::Query
- Defined in:
- app/models/motor/query.rb
Instance Method Summary collapse
- #result(variables_hash = {}) ⇒ Object (also: #run)
Methods inherited from ApplicationRecord
Instance Method Details
#result(variables_hash = {}) ⇒ Object Also known as: run
18 19 20 21 22 23 |
# File 'app/models/motor/query.rb', line 18 def result(variables_hash = {}) result = Motor::Queries::RunQuery.call!(self, variables_hash: variables_hash) column_names = result.columns.pluck(:name) result.data.map { |row| column_names.zip(row).to_h } end |