Module: MongoMapper

Defined in:
lib/mongomapper/serialization.rb,
lib/mongomapper.rb,
lib/mongomapper/key.rb,
lib/mongomapper/document.rb,
lib/mongomapper/callbacks.rb,
lib/mongomapper/observing.rb,
lib/mongomapper/pagination.rb,
lib/mongomapper/validations.rb,
lib/mongomapper/associations.rb,
lib/mongomapper/dynamic_finder.rb,
lib/mongomapper/finder_options.rb,
lib/mongomapper/associations/base.rb,
lib/mongomapper/embedded_document.rb,
lib/mongomapper/associations/proxy.rb,
lib/mongomapper/save_with_validation.rb,
lib/mongomapper/associations/many_proxy.rb,
lib/mongomapper/serializers/json_serializer.rb,
lib/mongomapper/rails_compatibility/document.rb,
lib/mongomapper/associations/belongs_to_proxy.rb,
lib/mongomapper/associations/many_embedded_proxy.rb,
lib/mongomapper/associations/many_documents_proxy.rb,
lib/mongomapper/associations/many_polymorphic_proxy.rb,
lib/mongomapper/associations/many_documents_as_proxy.rb,
lib/mongomapper/rails_compatibility/embedded_document.rb,
lib/mongomapper/associations/belongs_to_polymorphic_proxy.rb,
lib/mongomapper/associations/many_embedded_polymorphic_proxy.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Associations, Callbacks, Document, EmbeddedDocument, Observing, Pagination, RailsCompatibility, SaveWithValidation, Serialization, Validations Classes: DynamicFinder, FinderOptions, Key, Observer

Constant Summary collapse

DocumentNotFound =
Class.new(StandardError)
DocumentNotValid =
Class.new(StandardError) do
  def initialize(document)
    @document = document
    super("Validation failed: #{@document.errors.full_messages.join(", ")}")
  end
end

Class Method Summary collapse

Class Method Details

.connectionObject



56
57
58
# File 'lib/mongomapper.rb', line 56

def self.connection
  @@connection ||= Mongo::Connection.new
end

.connection=(new_connection) ⇒ Object



60
61
62
# File 'lib/mongomapper.rb', line 60

def self.connection=(new_connection)
  @@connection = new_connection
end

.databaseObject



68
69
70
# File 'lib/mongomapper.rb', line 68

def self.database
  @@database
end

.database=(name) ⇒ Object



64
65
66
# File 'lib/mongomapper.rb', line 64

def self.database=(name)
  @@database = MongoMapper.connection.db(name)
end