Sha256: b073496d47e8d00b263e09009acd518d887a1ee6d29da8d3001505d4db28243d

Contents?: true

Size: 407 Bytes

Versions: 3

Compression:

Stored size: 407 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

    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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blazer-1.0.2 app/models/blazer/query.rb
blazer-1.0.1 app/models/blazer/query.rb
blazer-1.0.0 app/models/blazer/query.rb