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
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
.connection ⇒ Object
47
48
49
|
# File 'lib/mongomapper.rb', line 47
def self.connection
@@connection ||= Mongo::Connection.new
end
|
.connection=(new_connection) ⇒ Object
51
52
53
|
# File 'lib/mongomapper.rb', line 51
def self.connection=(new_connection)
@@connection = new_connection
end
|
60
61
62
63
64
65
66
|
# File 'lib/mongomapper.rb', line 60
def self.database
if @@database_name.blank?
raise 'You forgot to set the default database name: MongoMapper.database = "foobar"'
end
@@database ||= MongoMapper.connection.db(@@database_name)
end
|
.database=(name) ⇒ Object
55
56
57
58
|
# File 'lib/mongomapper.rb', line 55
def self.database=(name)
@@database = nil
@@database_name = name
end
|