Module: MongoMapper::Plugins

Includes:
ActiveSupport::DescendantsTracker
Included in:
Document, EmbeddedDocument
Defined in:
lib/mongo_mapper.rb,
lib/mongo_mapper/plugins.rb,
lib/mongo_mapper/plugins/sci.rb,
lib/mongo_mapper/plugins/keys.rb,
lib/mongo_mapper/plugins/safe.rb,
lib/mongo_mapper/plugins/rails.rb,
lib/mongo_mapper/plugins/touch.rb,
lib/mongo_mapper/plugins/dirty.rb,
lib/mongo_mapper/plugins/clone.rb,
lib/mongo_mapper/plugins/logger.rb,
lib/mongo_mapper/plugins/scopes.rb,
lib/mongo_mapper/plugins/inspect.rb,
lib/mongo_mapper/plugins/caching.rb,
lib/mongo_mapper/plugins/indexes.rb,
lib/mongo_mapper/plugins/document.rb,
lib/mongo_mapper/plugins/equality.rb,
lib/mongo_mapper/plugins/querying.rb,
lib/mongo_mapper/plugins/dumpable.rb,
lib/mongo_mapper/plugins/keys/key.rb,
lib/mongo_mapper/plugins/modifiers.rb,
lib/mongo_mapper/plugins/callbacks.rb,
lib/mongo_mapper/plugins/protected.rb,
lib/mongo_mapper/plugins/timestamps.rb,
lib/mongo_mapper/plugins/pagination.rb,
lib/mongo_mapper/plugins/accessible.rb,
lib/mongo_mapper/plugins/userstamps.rb,
lib/mongo_mapper/plugins/validations.rb,
lib/mongo_mapper/plugins/persistence.rb,
lib/mongo_mapper/plugins/associations.rb,
lib/mongo_mapper/plugins/active_model.rb,
lib/mongo_mapper/plugins/identity_map.rb,
lib/mongo_mapper/plugins/serialization.rb,
lib/mongo_mapper/plugins/dynamic_querying.rb,
lib/mongo_mapper/plugins/embedded_document.rb,
lib/mongo_mapper/plugins/associations/base.rb,
lib/mongo_mapper/plugins/associations/proxy.rb,
lib/mongo_mapper/plugins/embedded_callbacks.rb,
lib/mongo_mapper/plugins/associations/one_proxy.rb,
lib/mongo_mapper/plugins/associations/collection.rb,
lib/mongo_mapper/plugins/associations/one_as_proxy.rb,
lib/mongo_mapper/plugins/associations/in_array_proxy.rb,
lib/mongo_mapper/plugins/associations/one_association.rb,
lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb,
lib/mongo_mapper/plugins/associations/many_association.rb,
lib/mongo_mapper/plugins/associations/single_association.rb,
lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb,
lib/mongo_mapper/plugins/associations/one_embedded_proxy.rb,
lib/mongo_mapper/plugins/querying/decorated_plucky_query.rb,
lib/mongo_mapper/plugins/associations/embedded_collection.rb,
lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb,
lib/mongo_mapper/plugins/associations/many_documents_proxy.rb,
lib/mongo_mapper/plugins/associations/belongs_to_association.rb,
lib/mongo_mapper/plugins/associations/many_polymorphic_proxy.rb,
lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb,
lib/mongo_mapper/plugins/rails/active_record_association_adapter.rb,
lib/mongo_mapper/plugins/associations/belongs_to_polymorphic_proxy.rb,
lib/mongo_mapper/plugins/associations/one_embedded_polymorphic_proxy.rb,
lib/mongo_mapper/plugins/associations/many_embedded_polymorphic_proxy.rb

Defined Under Namespace

Modules: Accessible, ActiveModel, Associations, Caching, Callbacks, Clone, Dirty, Document, Dumpable, DynamicQuerying, EmbeddedCallbacks, EmbeddedDocument, Equality, IdentityMap, Indexes, Inspect, Keys, Logger, Modifiers, Pagination, Persistence, Protected, Querying, Rails, Safe, Sci, Scopes, Serialization, Timestamps, Touch, Userstamps, Validations Classes: XmlSerializer

Instance Method Summary collapse

Instance Method Details

#included(base = nil) ⇒ Object



17
18
19
20
# File 'lib/mongo_mapper/plugins.rb', line 17

def included(base = nil)
  direct_descendants << base if base
  super
end

#plugin(mod) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
# File 'lib/mongo_mapper/plugins.rb', line 10

def plugin(mod)
  raise ArgumentError,  "Plugins must extend ActiveSupport::Concern" unless ActiveSupport::Concern === mod
  include mod
  direct_descendants.each {|model| model.send(:include, mod) }
  plugins << mod
end

#pluginsObject



6
7
8
# File 'lib/mongo_mapper/plugins.rb', line 6

def plugins
  @plugins ||= []
end