Sha256: 1c4e8cf70fc6ced9bb8401e00a487673907c2254cfe1cb319141992abaf76bdb
Contents?: true
Size: 634 Bytes
Versions: 2
Compression:
Stored size: 634 Bytes
Contents
# frozen_string_literal: true module Motor class Query < ::Motor::ApplicationRecord audited belongs_to :author, polymorphic: true, optional: true has_many :taggable_tags, as: :taggable has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag' serialize :preferences, HashSerializer scope :active, -> { where(deleted_at: nil) } 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 alias run result end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motor-admin-0.1.39 | app/models/motor/query.rb |
motor-admin-0.1.37 | app/models/motor/query.rb |