Module: MongoTanker::ORM::Mongoid::ClassMethods

Defined in:
lib/mongo_tanker/orm/mongoid.rb

Overview

Class Methods ———————————

Instance Method Summary collapse

Instance Method Details

#mongo_tanker(options = {}) ⇒ Object

searchify set searchify parameters for the model implementing this concern.

Options

:doc_id Name of a Rails route to use as the doc_id

:use_route_as_doc_id (default: true) Set to false if the :doc_id value should be treated as string

:index (default: MongoTanker.default_index) Name of the Searchify index this resource will be indexed against.

:sync_mode (default: true) Automatically execute indexing push/removal

Options:
 :all     - auto push & remove from indexes
 :none    - do nothing automatically
 :push    - only perform index pushes automatically
 :remove  - only remove from indexes automatically


39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mongo_tanker/orm/mongoid.rb', line 39

def mongo_tanker( options={} )
  @mongo_tanker           = @mongo_tanker || {}

  default_options         = {
    :doc_id_route         => @mongo_tanker.fetch(:doc_id_route, nil),
    :index_name           => @mongo_tanker.fetch(:index_name, MongoTanker.default_index),
    :sync_mode            => @mongo_tanker.fetch(:sync_mode, :all)
  }

  @mongo_tanker = default_options.merge options
  return @mongo_tanker
end

#mongo_tanker_document_defaultsObject

Map document



53
54
55
56
57
58
# File 'lib/mongo_tanker/orm/mongoid.rb', line 53

def mongo_tanker_document_defaults
  fields = {
  }

  return fields
end