Sha256: f82f5e3691ca92a371ef6130d26c82ceb6e6c935d6c67cdb4412203774946d27

Contents?: true

Size: 688 Bytes

Versions: 24

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module Motor
  class Dashboard < ::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'

    attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }

    if Rails.version.to_f >= 7.1
      serialize :preferences, coder: HashSerializer
    else
      serialize :preferences, HashSerializer
    end

    scope :active, -> { where(deleted_at: nil) }

    def queries
      Motor::Query.where(id: preferences[:layout].pluck(:query_id))
    end
  end
end

Version data entries

24 entries across 24 versions & 4 rubygems

Version Path
motor-admin-0.4.34 app/models/motor/dashboard.rb
motor-admin-0.4.33 app/models/motor/dashboard.rb
motor-admin-0.4.32 app/models/motor/dashboard.rb
motor-admin-0.4.31 app/models/motor/dashboard.rb
motor-admin-0.4.30 app/models/motor/dashboard.rb
motor-admin-0.4.29 app/models/motor/dashboard.rb
motor-admin-0.4.28 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.35 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.34 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.33 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.32 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.31 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.30 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.29 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.28 app/models/motor/dashboard.rb
motor-admin-cstham8-0.4.27 app/models/motor/dashboard.rb
motor-admin-0.4.27 app/models/motor/dashboard.rb
motor-admin-unosquare-0.4.28 app/models/motor/dashboard.rb
motor-admin-unosquare-0.4.27 app/models/motor/dashboard.rb
motor-admin-pz-0.4.26 app/models/motor/dashboard.rb