Sha256: 0d969b03961aff8f92700c6d13c12794c79280b3ac67b57d858b835a9f2e891a
Contents?: true
Size: 653 Bytes
Versions: 4
Compression:
Stored size: 653 Bytes
Contents
module Blazer class Query < ActiveRecord::Base belongs_to :creator, class_name: Blazer.user_class.to_s if Blazer.user_class has_many :checks, dependent: :destroy has_many :dashboard_queries, dependent: :destroy has_many :dashboards, through: :dashboard_queries has_many :audits validates :statement, presence: true scope :named, -> { where("name <> ''") } def to_param [id, name].compact.join("-").gsub("'", "").parameterize end def friendly_name name.to_s.gsub(/\[.+\]/, "").strip end def editable?(user) (name.present? && name.first != "*") || user == creator end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
blazer-1.3.1 | app/models/blazer/query.rb |
blazer-1.3.0 | app/models/blazer/query.rb |
blazer-1.2.1 | app/models/blazer/query.rb |
blazer-1.2.0 | app/models/blazer/query.rb |