Module: Mongoid::Document::Taggable

Overview

This was originally part of mongoid-simple-tags, but that gem is no longer maintained so we’ve opted to vendor in the functionality here.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/workarea/ext/freedom_patches/mongoid_simple_tags.rb', line 7

def self.included(base)
  base.class_eval do |klass|
    klass.field :tags, type: Array, default: []
    klass.index({ tags: 1 }, { background: true })

    include InstanceMethods
    extend ClassMethods
  end
end