12345678910111213141516171819 |
- 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 :audits
- validates :name, presence: true
- validates :statement, presence: true
- def to_param
- [id, name.gsub("'", "").parameterize].join("-")
- end
- def friendly_name
- name.gsub(/\[.+\]/, "").strip
- end
- end
- end
|