Sha256: 0926b488145f87d58693154cb164fb28226cacc2778c706b64c6ea4b73ed7a94

Contents?: true

Size: 714 Bytes

Versions: 7

Compression:

Stored size: 714 Bytes

Contents

module Remetric
  class Trackable
    include Mongoid::Document
    include Mongoid::Timestamps

    field :model
    field :key
    field :data, type: Hash
    
    index({ key: 1 }, { unique: true, name: "trackable_key_index" })
    
    validates_presence_of :model
    validates_presence_of :key
    validates_uniqueness_of :key, scope: :model
    
    def self.matchers
      [
        ["contains", "ilike"],
        ["is exactly", "="],
        ["is not", "!="],
        ["greater than", ">"],
        ["greater than or equal to", ">="],
        ["less than", "<"],
        ["less than or equal to", "<="],
        ["exists", "exists"],
        ["does not exist", "does not exist"]
      ]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
remetric-0.0.9 app/models/remetric/trackable.rb
remetric-0.0.8 app/models/remetric/trackable.rb
remetric-0.0.7 app/models/remetric/trackable.rb
remetric-0.0.6 app/models/remetric/trackable.rb
remetric-0.0.5 app/models/remetric/trackable.rb
remetric-0.0.4 app/models/remetric/trackable.rb
remetric-0.0.3 app/models/remetric/trackable.rb