Sha256: d6d23545a31f589cf78bc3851a27d21f3ede22996a3bb942a3e02016e13925e8
Contents?: true
Size: 697 Bytes
Versions: 9
Compression:
Stored size: 697 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, dependent: :destroy has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag' has_many :alerts, dependent: :destroy 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
9 entries across 9 versions & 1 rubygems