Created
January 23, 2011 21:19
-
-
Save jacortinas/792446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/hack/mongoid@master ls | |
Gemfile Rakefile scripts/ | |
Gemfile.lock lib/ spec/ | |
LICENSE mongoid.gemspec | |
README.rdoc perf/ | |
~/hack/mongoid@master rake | |
(in /Users/jacortinas/hack/mongoid) | |
/Users/jacortinas/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -S bundle exec rspec spec/integration/mongoid/attributes_spec.rb spec/integration/mongoid/callback_spec.rb spec/integration/mongoid/config/database_spec.rb spec/integration/mongoid/config/replset_database_spec.rb spec/integration/mongoid/config_spec.rb spec/integration/mongoid/contexts/enumerable_spec.rb spec/integration/mongoid/contexts/mongo_spec.rb spec/integration/mongoid/criteria_spec.rb spec/integration/mongoid/criterion/creational_spec.rb spec/integration/mongoid/criterion/destructive_spec.rb spec/integration/mongoid/criterion/exclusion_spec.rb spec/integration/mongoid/criterion/inclusion_spec.rb spec/integration/mongoid/criterion/inspection_spec.rb spec/integration/mongoid/criterion/modification_spec.rb spec/integration/mongoid/default_scope_spec.rb spec/integration/mongoid/dirty_spec.rb spec/integration/mongoid/document_spec.rb spec/integration/mongoid/extensions_spec.rb spec/integration/mongoid/finders_spec.rb spec/integration/mongoid/inheritance_spec.rb spec/integration/mongoid/modifiers/inc_spec.rb spec/integration/mongoid/named_scope_spec.rb spec/integration/mongoid/nested_attributes_spec.rb spec/integration/mongoid/paranoia_spec.rb spec/integration/mongoid/persistence/insert_spec.rb spec/integration/mongoid/persistence/update_spec.rb spec/integration/mongoid/persistence_spec.rb spec/integration/mongoid/relations/accessors_spec.rb spec/integration/mongoid/relations/auto_save_spec.rb spec/integration/mongoid/relations/builders/referenced/in_spec.rb spec/integration/mongoid/relations/builders/referenced/many_spec.rb spec/integration/mongoid/relations/builders/referenced/many_to_many_spec.rb spec/integration/mongoid/relations/builders/referenced/one_spec.rb spec/integration/mongoid/relations/cascading_spec.rb spec/integration/mongoid/relations/embedded/in_spec.rb spec/integration/mongoid/relations/embedded/many_spec.rb spec/integration/mongoid/relations/embedded/one_spec.rb spec/integration/mongoid/relations/referenced/in_spec.rb spec/integration/mongoid/relations/referenced/many_spec.rb spec/integration/mongoid/relations/referenced/many_to_many_spec.rb spec/integration/mongoid/relations/referenced/one_spec.rb spec/integration/mongoid/safety_spec.rb spec/integration/mongoid/serialization_spec.rb spec/integration/mongoid/validations/associated_spec.rb spec/integration/mongoid/validations/uniqueness_spec.rb spec/integration/mongoid/validations_spec.rb spec/integration/mongoid/versioning_spec.rb spec/unit/mongoid/atomicity_spec.rb spec/unit/mongoid/attributes_spec.rb spec/unit/mongoid/callbacks_spec.rb spec/unit/mongoid/collection_spec.rb spec/unit/mongoid/collections/cyclic_iterator_spec.rb spec/unit/mongoid/collections/master_spec.rb spec/unit/mongoid/collections/slaves_spec.rb spec/unit/mongoid/collections_spec.rb spec/unit/mongoid/contexts/enumerable/sort_spec.rb spec/unit/mongoid/contexts/enumerable_spec.rb spec/unit/mongoid/contexts/mongo_spec.rb spec/unit/mongoid/contexts_spec.rb spec/unit/mongoid/copyable_spec.rb spec/unit/mongoid/criteria_spec.rb spec/unit/mongoid/criterion/complex_spec.rb spec/unit/mongoid/criterion/creational_spec.rb spec/unit/mongoid/criterion/exclusion_spec.rb spec/unit/mongoid/criterion/inclusion_spec.rb spec/unit/mongoid/criterion/optional_spec.rb spec/unit/mongoid/criterion/selector_spec.rb spec/unit/mongoid/cursor_spec.rb spec/unit/mongoid/default_scope_spec.rb spec/unit/mongoid/dirty_spec.rb spec/unit/mongoid/document_spec.rb spec/unit/mongoid/errors_spec.rb spec/unit/mongoid/extensions/array/conversions_spec.rb spec/unit/mongoid/extensions/array/parentization_spec.rb spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb spec/unit/mongoid/extensions/binary/conversions_spec.rb spec/unit/mongoid/extensions/boolean/conversions_spec.rb spec/unit/mongoid/extensions/date/conversions_spec.rb spec/unit/mongoid/extensions/datetime/conversions_spec.rb spec/unit/mongoid/extensions/false_class/equality_spec.rb spec/unit/mongoid/extensions/float/conversions_spec.rb spec/unit/mongoid/extensions/hash/conversions_spec.rb spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb spec/unit/mongoid/extensions/hash/scoping_spec.rb spec/unit/mongoid/extensions/integer/conversions_spec.rb spec/unit/mongoid/extensions/nil/collectionization_spec.rb spec/unit/mongoid/extensions/object/conversions_spec.rb spec/unit/mongoid/extensions/object/yoda_spec.rb spec/unit/mongoid/extensions/objectid/conversions_spec.rb spec/unit/mongoid/extensions/proc/scoping_spec.rb spec/unit/mongoid/extensions/set/conversions_spec.rb spec/unit/mongoid/extensions/string/conversions_spec.rb spec/unit/mongoid/extensions/string/inflections_spec.rb spec/unit/mongoid/extensions/symbol/conversions_spec.rb spec/unit/mongoid/extensions/symbol/inflections_spec.rb spec/unit/mongoid/extensions/time_conversions_spec.rb spec/unit/mongoid/extensions/true_class/equality_spec.rb spec/unit/mongoid/extras_spec.rb spec/unit/mongoid/factory_spec.rb spec/unit/mongoid/field_spec.rb spec/unit/mongoid/fields_spec.rb spec/unit/mongoid/finders_spec.rb spec/unit/mongoid/hierarchy_spec.rb spec/unit/mongoid/identity_spec.rb spec/unit/mongoid/indexes_spec.rb spec/unit/mongoid/inspection_spec.rb spec/unit/mongoid/javascript_spec.rb spec/unit/mongoid/json_spec.rb spec/unit/mongoid/keys_spec.rb spec/unit/mongoid/locales_spec.rb spec/unit/mongoid/logger_spec.rb spec/unit/mongoid/matchers/all_spec.rb spec/unit/mongoid/matchers/default_spec.rb spec/unit/mongoid/matchers/exists_spec.rb spec/unit/mongoid/matchers/gt_spec.rb spec/unit/mongoid/matchers/gte_spec.rb spec/unit/mongoid/matchers/in_spec.rb spec/unit/mongoid/matchers/lt_spec.rb spec/unit/mongoid/matchers/lte_spec.rb spec/unit/mongoid/matchers/ne_spec.rb spec/unit/mongoid/matchers/nin_spec.rb spec/unit/mongoid/matchers/size_spec.rb spec/unit/mongoid/matchers_spec.rb spec/unit/mongoid/modifiers/inc_spec.rb spec/unit/mongoid/modifiers_spec.rb spec/unit/mongoid/multi_database_spec.rb spec/unit/mongoid/multi_parameter_attributes_spec.rb spec/unit/mongoid/named_scope_spec.rb spec/unit/mongoid/nested_attributes_spec.rb spec/unit/mongoid/paranoia_spec.rb spec/unit/mongoid/paths_spec.rb spec/unit/mongoid/persistence/insert_embedded_spec.rb spec/unit/mongoid/persistence/insert_spec.rb spec/unit/mongoid/persistence/remove_all_spec.rb spec/unit/mongoid/persistence/remove_embedded_spec.rb spec/unit/mongoid/persistence/remove_spec.rb spec/unit/mongoid/persistence/update_spec.rb spec/unit/mongoid/persistence_spec.rb spec/unit/mongoid/railties/document_spec.rb spec/unit/mongoid/relations/accessors_spec.rb spec/unit/mongoid/relations/bindings/embedded/in_spec.rb spec/unit/mongoid/relations/bindings/embedded/many_spec.rb spec/unit/mongoid/relations/bindings/embedded/one_spec.rb spec/unit/mongoid/relations/bindings/referenced/in_spec.rb spec/unit/mongoid/relations/bindings/referenced/one_spec.rb spec/unit/mongoid/relations/builders/embedded/in_spec.rb spec/unit/mongoid/relations/builders/embedded/many_spec.rb spec/unit/mongoid/relations/builders/embedded/one_spec.rb spec/unit/mongoid/relations/builders/nested_attributes/many_spec.rb spec/unit/mongoid/relations/builders/nested_attributes/one_spec.rb spec/unit/mongoid/relations/builders/referenced/in_spec.rb spec/unit/mongoid/relations/builders/referenced/many_spec.rb spec/unit/mongoid/relations/builders/referenced/many_to_many_spec.rb spec/unit/mongoid/relations/builders/referenced/one_spec.rb spec/unit/mongoid/relations/builders_spec.rb spec/unit/mongoid/relations/cascading/delete_spec.rb spec/unit/mongoid/relations/cascading/destroy_spec.rb spec/unit/mongoid/relations/cascading/nullify_spec.rb spec/unit/mongoid/relations/cascading_spec.rb spec/unit/mongoid/relations/constraint_spec.rb spec/unit/mongoid/relations/cyclic_spec.rb spec/unit/mongoid/relations/embedded/in_spec.rb spec/unit/mongoid/relations/embedded/many_spec.rb spec/unit/mongoid/relations/embedded/one_spec.rb spec/unit/mongoid/relations/macros_spec.rb spec/unit/mongoid/relations/metadata_spec.rb spec/unit/mongoid/relations/polymorphic_spec.rb spec/unit/mongoid/relations/referenced/in_spec.rb spec/unit/mongoid/relations/referenced/many_spec.rb spec/unit/mongoid/relations/referenced/many_to_many_spec.rb spec/unit/mongoid/relations/referenced/one_spec.rb spec/unit/mongoid/relations/reflections_spec.rb spec/unit/mongoid/relations_spec.rb spec/unit/mongoid/safety_spec.rb spec/unit/mongoid/scope_spec.rb spec/unit/mongoid/serialization_spec.rb spec/unit/mongoid/state_spec.rb spec/unit/mongoid/timestamps_spec.rb spec/unit/mongoid/validations/associated_spec.rb spec/unit/mongoid/validations/uniqueness_spec.rb spec/unit/mongoid/validations_spec.rb spec/unit/mongoid/versioning_spec.rb spec/unit/mongoid_spec.rb spec/unit/rails/mongoid_spec.rb | |
--------------------------------------------------------------------- | |
The Mongoid configuration specs require 2 slave databases to be | |
running in order to properly be tested. Those specs are skipped when | |
the slaves are not running locally. | |
See the following configuration files for assistance: | |
spec/config/mongod.conf | |
spec/config/mongod.slave.one.conf | |
spec/config/mongod.slave.two.conf | |
--------------------------------------------------------------------- | |
--------------------------------------------------------------------- | |
A user needs to be configured for authentication, otherwise some | |
configuration specs will not get run. You may set it up from the | |
mongo console: | |
$ use mongoid_test; | |
$ db.addUser("mongoid", "test"); | |
--------------------------------------------------------------------- | |
--------------------------------------------------------------------- | |
The Mongoid configuration specs require an internet connection to | |
connect to the test mongohq database, or require the username and | |
password set as environment variables. If you need the credentials | |
and want these specs to run, please contact durran at gmail dot com. | |
ENV["MONGOHQ_USER_MONGOID"] | |
ENV["MONGOHQ_PASSWORD_MONGOID"] | |
--------------------------------------------------------------------- | |
--------------------------------------------------------------------- | |
The Mongoid configuration specs require a secondary master with 2 | |
secondary slave databases to be running in order to properly be | |
tested. For multi-database configurations. Those specs are skipped | |
when those 3 databases are not running locally. | |
See the following configuration files for assistance: | |
spec/config/mongod.alt.conf | |
spec/config/mongod.alt.slave.one.conf | |
spec/config/mongod.alt.slave.two.conf | |
--------------------------------------------------------------------- | |
Mongoid::Attributes | |
when persisting nil attributes | |
has an entry in the attributes | |
with a default last_drink_taken_at | |
saves the default | |
when default values are defined | |
does not override the default | |
Mongoid::Callbacks | |
callback on valid? | |
should go in all validation callback in good order | |
when creating child documents in callbacks | |
does not duplicate the child documents | |
Mongoid::Config::Database | |
#configure | |
when configuring a master instance | |
when provided a uri | |
when the uri is on mongohq | |
when no pool size provided | |
when a pool size is provided | |
when no uri provided | |
when a host is provided | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node host to the uri host | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node port to the uri port | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the database name to the uri database name | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the pool size to 1 | |
when no host is provided | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node host to localhost | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node port to the uri port | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the database name to the uri database name | |
when a port is provided | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node host to localhost | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node port to the uri port | |
when no port is provided | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node host to localhost | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the node port to the uri port | |
when a username and password are provided | |
when configuring a slave instances | |
when provided a uri | |
when no pool size provided | |
when a pool size is provided | |
when no uri provided | |
when hosts are provided | |
when no host is provided | |
when a username and password are provided | |
Mongoid::Config::ReplsetDatabase | |
#configure | |
returns a replica set connection | |
sets slave ok to true | |
does not configure specific slaves | |
Mongoid::Config | |
.add_language | |
when adding a language | |
adds the language | |
.destructive_fields | |
returns a list of method names | |
.from_hash | |
when using a standard configuration | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the master db | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets allow_dynamic_fields | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets include_root_in_json | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets reconnect_time | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets parameterize keys | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets persist_in_safe_mode | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets raise_not_found_error | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
returns nil, which is interpreted as the local time_zone | |
when configuring with slaves | |
when configuring with utc time | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
sets the utc flag | |
when configuring with multiple databases | |
when configuring with mongohq | |
when configured with replset | |
should create a regular Mongo::ReplSetConnection | |
.logger | |
returns the config logger | |
.logger= | |
sets the logger on the config | |
.master | |
when a database was set | |
returns the database | |
.master= | |
when provided a mongo database | |
sets the master | |
when not provided a mongo database | |
raises an error | |
.option | |
creates a getter for the option | |
creates a setter for the option | |
creates a conditional for the option | |
allows the setting of a default value | |
when defining options | |
.allow_dynamic_fields | |
defaults to true | |
.include_root_in_json | |
defaults to false | |
.parameterize_keys | |
defaults to true | |
.persist_in_safe_mode | |
defaults to false | |
.raise_not_found_error | |
defaults to true | |
.reconnect_time | |
defaults to 3 | |
.autocreate_indexes | |
defaults to false | |
.skip_version_check | |
defaults to false | |
.time_zone | |
defaults to nil | |
.reset | |
clears out the settings | |
.slaves | |
when slaves exist | |
when no slaves exist | |
.slaves= | |
when provided databases | |
when not provided databases | |
Mongoid::Contexts::Enumerable | |
#limit | |
returns the specified number of documents | |
#paginate | |
paginates the embedded documents | |
#order_by | |
ascending | |
sorts by a simple key | |
sorts by a compound key | |
descending | |
sorts by a simple key | |
sorts by a compound key | |
with ascending and descending | |
sorts by ascending first | |
sorts by descending first | |
#shift | |
returns the first element | |
skips to the next value | |
#skip | |
excludes the specified number of document | |
Mongoid::Contexts::Mongo | |
#avg | |
when no documents are in the collection | |
returns nil | |
when documents exist in the collection | |
returns the average for the field | |
#count | |
when documents exist in the collection | |
without skip or limit | |
returns the number of documents | |
with skip and limit | |
by default | |
ignores previous offset/limit statements | |
when passed 'true' | |
includes previous offset/limit statements | |
when passed 'false' | |
ignores previous offset/limit statements | |
#max | |
when no documents are in the collection | |
returns nil | |
when documents are in the collection | |
returns the maximum for the field | |
#min | |
when no documents are in the collection | |
returns nil | |
when documents are in the collection | |
returns the minimum for the field | |
#sum | |
when no documents are in the collection | |
returns nil | |
when documents are in the collection | |
returns the sum for the field | |
Mongoid::Criteria | |
when caching | |
iterates over the cursor only once | |
#id | |
when using object ids | |
should find object with String args | |
should find object with BSON::ObjectId args | |
when not using object ids | |
should find object with String args | |
should not find object with BSON::ObjectId args | |
#to_json | |
returns the results as a json string | |
Mongoid::Criterion::Creational | |
#create | |
when provided a valid selector | |
inserts a new document into the database | |
returns the document | |
sets the top level attributes | |
when provided invalid selectors | |
ignores the attributes | |
Mongoid::Criteria | |
#delete | |
when removing root documents | |
deletes the removes the documents from the database | |
returns the number removed | |
when removing embedded documents | |
deletes the removes the documents from the database | |
returns the number removed | |
#delete_all | |
when removing root documents | |
deletes the removes the documents from the database | |
returns the number removed | |
when removing embedded documents | |
deletes the removes the documents from the database | |
returns the number removed | |
#destroy | |
when removing root documents | |
deletes the removes the documents from the database | |
returns the number removed | |
when removing embedded documents | |
deletes the removes the documents from the database | |
returns the number removed | |
#destroy_all | |
when removing root documents | |
deletes the removes the documents from the database | |
returns the number removed | |
when removing embedded documents | |
deletes the removes the documents from the database | |
returns the number removed | |
Mongoid::Criterion::Exclusion | |
#excludes | |
when passed id | |
it properly excludes the documents | |
when passed _id | |
it properly excludes the documents | |
Mongoid::Criterion::Inclusion | |
#any_in | |
when the field value is nil | |
when searching for any value | |
returns the matching documents | |
when the field value is false | |
when searching for any value | |
returns the matching documents | |
#any_of | |
with a single match | |
returns any matching documents | |
when chaining for multiple matches | |
returns any matching documents | |
#find | |
when finding by an id | |
when the id is found | |
returns the matching document | |
when the id is not found | |
when raising a not found error | |
raises an error | |
when not raising a not found error | |
returns nil | |
when finding by an array of ids | |
when the id is found | |
returns the matching document | |
when the id is not found | |
when raising a not found error | |
raises an error | |
when not raising a not found error | |
returns an empty array | |
#where | |
chaining multiple wheres | |
when chaining on the same key | |
overrides the previous key | |
with untyped criteria | |
typecasts integers | |
typecasts datetimes | |
typecasts dates | |
typecasts times with zones | |
typecasts array elements | |
typecasts size criterion to integer | |
typecasts exists criterion to boolean | |
with multiple complex criteria | |
returns those matching both criteria | |
returns nothing if in and nin clauses cancel each other out | |
returns nothing if in and nin clauses cancel each other out ordered the other way | |
returns the intersection of in and nin clauses | |
with complex criterion | |
#all | |
returns those matching an all clause | |
#exists | |
returns those matching an exists clause | |
#gt | |
returns those matching a gt clause | |
#gte | |
returns those matching a gte clause | |
#in | |
returns those matching an in clause | |
#lt | |
returns those matching a lt clause | |
#lte | |
returns those matching a lte clause | |
#ne | |
returns those matching a ne clause | |
#nin | |
returns those matching a nin clause | |
#size | |
returns those matching a size clause | |
#match | |
returns those matching a partial element in a list | |
Mongoid::Criterion::Inspection | |
#inspect | |
when documents match in the database | |
returns the selector, options, and empty array | |
when no documents match in the database | |
returns the selector, options, and empty array | |
Mongoid::Criteria | |
#update | |
when updating the root document | |
when updating with a criteria | |
updates all the matching documents | |
when updating all directly | |
updates all the matching documents | |
when updating an embedded document | |
updates all the matching documents | |
does not update non matching documents | |
when updating a relation | |
when the relation is an embeds many | |
when updating the relation directly | |
updates the first document | |
updates the last document | |
when updating the relation through a criteria | |
updates the matching documents | |
does not update non matching documents | |
when the relation is a references many | |
when updating the relation directly | |
updates the first document | |
updates the last document | |
when updating the relation through a criteria | |
updates the matching documents | |
does not update non matching documents | |
when the relation is a references many to many | |
when updating the relation directly | |
updates the first document | |
updates the last document | |
when updating the relation through a criteria | |
updates the matching documents | |
does not update non matching documents | |
#update_all | |
when updating the root document | |
when updating with a criteria | |
updates all the matching documents | |
when updating all directly | |
updates all the matching documents | |
when updating an embedded document | |
updates all the matching documents | |
does not update non matching documents | |
when updating a relation | |
when the relation is an embeds many | |
when updating the relation directly | |
updates the first document | |
updates the last document | |
when updating the relation through a criteria | |
updates the matching documents | |
does not update non matching documents | |
when the relation is a references many | |
when updating the relation directly | |
updates the first document | |
updates the last document | |
when updating the relation through a criteria | |
updates the matching documents | |
does not update non matching documents | |
when the relation is a references many to many | |
when updating the relation directly | |
updates the first document | |
updates the last document | |
when updating the relation through a criteria | |
updates the matching documents | |
does not update non matching documents | |
Mongoid::DefaultScope | |
returns them in the correct order | |
respects other scopes | |
Mongoid::Dirty | |
when fields are getting changed | |
marks the document as changed | |
marks field changes | |
marks changed fields | |
marks the field as changed | |
stores previous field values | |
marks field changes | |
allows reset of field changes | |
after a save | |
clears changes | |
stores previous changes | |
when the previous value is nil | |
removes the attribute from the document | |
when associations are getting changed | |
should not set the association to nil when hitting the database | |
Mongoid::Document | |
defining a BSON::ObjectId as a field | |
persists the correct type | |
has the correct value | |
creating anonymous documents | |
when defining collection | |
allows the creation | |
#db | |
returns the mongo database | |
when document contains a hash field | |
properly gets and sets the has attributes | |
.collection | |
on a subclass of a root document | |
returns the root document collection | |
on a namespaced document | |
#new | |
gets a new or current database connection | |
#count | |
returns the count | |
#create | |
persists a new record to the database | |
when creating a has many | |
should create and save the entire graph | |
chaining criteria scopes | |
finds by the merged criteria | |
#destroy | |
on a root document | |
deletes the document | |
marks the document as destroyed | |
on an embedded document | |
deletes the document | |
.find_or_create_by | |
when the document is found | |
returns the document | |
when the document is not found | |
creates a new document | |
.find_or_initialize_by | |
when the document is found | |
returns the document | |
when the document is not found | |
returns a new document | |
#find | |
finding all documents | |
returns an array of documents based on the selector provided | |
finding first document | |
returns the first document based on the selector provided | |
finding by id | |
finds the document by the supplied id | |
limiting result fields | |
adds the type field to the options | |
#group | |
returns grouped documents | |
when address is a has one | |
is a single object and not an array | |
#paginate | |
returns paginated documents | |
returns a proper count | |
when paginating $or queries | |
returns the proper page | |
returns the proper number per page | |
returns the proper count | |
returns the proper total entries | |
#reload | |
reloads the object attributes from the db | |
reload should return self | |
when document not saved | |
when raising not found error | |
raises an error | |
when embedded documents change | |
should reload (unmemoize) the associations | |
with relational associations | |
for a references_one | |
should reload the association | |
for a referenced_in | |
should reload the association | |
#save | |
on a has_one association | |
saves the parent document | |
without validation | |
always persists | |
with failing validation | |
returns false | |
.store_in | |
switches the database collection | |
when has many exists through a has one | |
can clear the association | |
the lot | |
allows adding multiples on an embeds_many in a row | |
when saving on a has_one | |
saves the entire graph up from the has_one | |
when saving on an embeds_many | |
saves the entire graph up from the embeds_many | |
setting embedded_in | |
allows the parent reference to change | |
#to_json | |
on a new document | |
returns the json string | |
should return the id field correctly | |
on a persisted document | |
returns the json string | |
should return the id field correctly | |
typecasting | |
properly casts dates and times | |
versioning | |
first save | |
creates a new version | |
multiple saves | |
creates new versions | |
executing criteria with date comparisons | |
handling specific dates | |
handles comparisons with todays date | |
handles conparisons with a date range | |
handles false comparisons in a date range | |
handles comparisons with date objects | |
Mongoid::Extensions | |
setting floating point numbers | |
when value is an empty string | |
does not set the value | |
setting association foreign keys | |
when value is an empty string | |
should set the foreign key to empty | |
when value is a populated string | |
should set the foreign key as ObjectID | |
when value is a ObjectID | |
should keep the the foreign key as ObjectID | |
Mongoid::Finders | |
#find | |
when using string ids | |
with an id as an argument | |
when the document is found | |
returns the document | |
when the document is not found | |
raises an error | |
when passed an array of ids | |
when the documents are found | |
returns an array of the documents | |
when no documents found | |
raises an error | |
when passing an empty array | |
returns an empty array | |
when using object ids | |
when passed a BSON::ObjectId as an argument | |
when the document is found | |
returns the document | |
when the document is not found | |
raises an error | |
when passed a string id as an argument | |
when the document is found | |
returns the document | |
when the document is not found | |
raises an error | |
when passed an array of ids as args | |
when the documents are found | |
returns an array of the documents | |
when no documents found | |
raises an error | |
Mongoid::Document | |
when the document is a subclass of a root class | |
persists the versions | |
persists the type | |
persists the attributes | |
when the document is a subclass of a subclass | |
persists the versions | |
persists the type | |
persists the attributes | |
returns the document when querying for superclass | |
returns the document when querying for root class | |
should returns on of this subclasses if you find by _type | |
when the document has associations | |
properly persists the one-to-one type | |
properly persists the one-to-one relations | |
properly persists the one-to-many type | |
properly persists the one-to-many relations | |
properly sets up the parent relation | |
properly sets up the entire hierarchy | |
when document has subclasses | |
returns subclasses for querying parents | |
deleting subclasses | |
deletes from the parent class collection | |
deletes all documents except for those belonging to parent class collection | |
when document is a subclass and its parent is an embedded document | |
properly saves the subclasses | |
Creating references_many documents from a parent association | |
should allow STI from << using model.new | |
should allow STI from << using model.create | |
should allow STI from the build call | |
should allow STI from the build call | |
Mongoid::Modifiers::Inc | |
#inc | |
increments the field by the value | |
updates the database with the new value | |
Mongoid::NamedScope | |
.scope | |
accessing a single named scope | |
returns the document | |
chaining named scopes | |
returns the document | |
mixing named scopes and class methods | |
returns the document | |
using order_by in a named scope | |
sorts the results | |
Mongoid::NestedAttributes | |
#initialize | |
when the relation is an embeds one | |
sets the nested attributes | |
when the relation is an embeds many | |
sets the nested attributes | |
when the relation is an embedded in | |
sets the nested attributes | |
when the relation is a references one | |
sets the nested attributes | |
when the relation is a references many | |
sets the nested attributes | |
when the relation is a references and referenced in many | |
sets the nested attributes | |
when the relation is a referenced in | |
sets the nested attributes | |
#_attributes= | |
when the parent document is new | |
when the relation is an embeds one | |
when a reject proc is specified | |
when the attributes match | |
does not add the document | |
when the attributes do not match | |
adds the document | |
when :reject_if => :all_blank is specified | |
when all attributes are empty | |
does not add the document | |
when an attribute is non-empty | |
adds the document | |
when no id has been passed | |
with no destroy attribute | |
builds a new document | |
with a destroy attribute | |
when allow_destroy is true | |
does not build the document | |
when allow_destroy is false | |
builds the document | |
with empty attributes | |
does not build the document | |
when there is an existing document | |
with no destroy attribute | |
replaces the document | |
with a destroy attribute | |
when allow_destroy is true | |
does not replace the document | |
when allow_destroy is false | |
replaces the document | |
when an id is passed | |
when there is an existing record | |
when the id matches | |
when passed keys as symbols | |
updates the existing document | |
when passed keys as strings | |
updates the existing document | |
when allow_destroy is true | |
when passed 1 with destroy | |
destroys the existing document | |
when passed 1 with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when allow destroy is false | |
when a destroy attribute is passed | |
does not destroy the document | |
when update only is true | |
when the id matches | |
updates the existing document | |
when the id does not match | |
updates the existing document | |
when passed a destroy truth | |
destroys the existing document | |
when the relation is embedded in | |
when the child is new | |
when no id has been passed | |
when no destroy attribute passed | |
builds a new document | |
when a destroy attribute is passed | |
when allow_destroy is true | |
does not build a new document | |
when allow_destroy is false | |
builds a new document | |
when an id has been passed | |
when no destroy attribute passed | |
when the id matches | |
updates the existing document | |
when there is an existing document | |
when allow destroy is true | |
when passed 1 with destroy | |
destroys the existing document | |
when passed 1 with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when allow destroy is false | |
when a destroy attribute is passed | |
does not delete the document | |
when update only is true | |
when the id matches | |
updates the existing document | |
when the id does not match | |
updates the existing document | |
when passed a destroy truth | |
deletes the existing document | |
when the relation is an embeds many | |
when a limit is specified | |
when more are provided than the limit | |
raises an error | |
when less are provided than the limit | |
sets the documents on the relation | |
when ids are passed | |
when no destroy attributes are passed | |
when the ids match | |
updates the first existing document | |
updates the second existing document | |
does not add new documents | |
when the ids do not match | |
raises an error | |
when destroy attributes are passed | |
when the ids match | |
when allow_destroy is true | |
when passed a 1 with destroy | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a 1 with destroy | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a true with destroy | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a true with destroy | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when allow_destroy is false | |
when passed a 1 with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 1 with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 0 with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when allow_destroy is undefined | |
when passed a 1 with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 1 with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 0 with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
does not delete the marked document | |
does not delete the unmarked document | |
when no ids are passed | |
when no destroy attributes are passed | |
builds a new first document | |
builds a new second document | |
builds a new third document | |
does not add extra documents | |
adds the documents in the sorted hash key order | |
when a reject block is supplied | |
when the attributes match | |
does not add the new document | |
when the attributes do not match | |
adds the new document | |
sets the correct attributes | |
when :reject_if => :all_blank is supplied | |
when all attributes are empty | |
does not add the new document | |
when an attribute is not-empty | |
adds the new document | |
sets the correct attributes | |
when destroy attributes are passed | |
when allow_destroy is true | |
when passed a 1 with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a 1 with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a true with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a true with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when allow destroy is false | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when allow destroy is not defined | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when the relation is a references one | |
when a reject proc is specified | |
when the attributes match | |
does not add the document | |
when the attributes do not match | |
adds the document | |
when reject_if => :all_blank is specified | |
when all attributes are empty | |
does not add the document | |
when an attribute is non-empty | |
adds the document | |
when no id has been passed | |
with no destroy attribute | |
builds a new document | |
with a destroy attribute | |
when allow_destroy is true | |
does not build the document | |
when allow_destroy is false | |
builds the document | |
with empty attributes | |
does not build the document | |
when there is an existing document | |
with no destroy attribute | |
replaces the document | |
with a destroy attribute | |
when allow_destroy is true | |
does not replace the document | |
when allow_destroy is false | |
replaces the document | |
when an id is passed | |
when there is an existing record | |
when the id matches | |
when passed keys as symbols | |
updates the existing document | |
when passed keys as strings | |
updates the existing document | |
when allow_destroy is true | |
when passed 1 with destroy | |
destroys the existing document | |
when passed 1 with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when allow destroy is false | |
when a destroy attribute is passed | |
does not destroy the document | |
when update only is true | |
when the id matches | |
updates the existing document | |
when the id does not match | |
updates the existing document | |
when passed a destroy truth | |
destroys the existing document | |
when the relation is referenced in | |
when the child is new | |
when no id has been passed | |
when no destroy attribute passed | |
builds a new document | |
when a destroy attribute is passed | |
when allow_destroy is true | |
does not build a new document | |
when allow_destroy is false | |
builds a new document | |
when an id has been passed | |
when no destroy attribute passed | |
when the id matches | |
updates the existing document | |
when there is an existing document | |
when allow destroy is true | |
when passed 1 with destroy | |
destroys the existing document | |
when passed 1 with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed true with destroy | |
destroys the existing document | |
when passed with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed 0 with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when passed false with destroy | |
does not destroy the existing document | |
when allow destroy is false | |
when a destroy attribute is passed | |
does not delete the document | |
when update only is true | |
when the id matches | |
updates the existing document | |
when the id does not match | |
updates the existing document | |
when passed a destroy truth | |
deletes the existing document | |
when the relation is a references many | |
when a limit is specified | |
when more are provided than the limit | |
raises an error | |
when less are provided than the limit | |
sets the documents on the relation | |
when ids are passed | |
when no destroy attributes are passed | |
when the ids match | |
when reloading the document | |
updates the first existing document | |
updates the second existing document | |
does not add new documents | |
when the ids do not match | |
raises an error | |
when destroy attributes are passed | |
when the ids match | |
when allow_destroy is true | |
when passed a 1 with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a 1 with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a true with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a true with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when allow_destroy is false | |
when passed a 1 with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 1 with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 0 with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when allow_destroy is undefined | |
when passed a 1 with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 1 with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 0 with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when no ids are passed | |
when no destroy attributes are passed | |
builds a new first document | |
builds a new second document | |
builds a new third document | |
does not add extra documents | |
adds the documents in the sorted hash key order | |
when a reject block is supplied | |
when the attributes match | |
does not add the new document | |
when the attributes do not match | |
adds the new document | |
sets the correct attributes | |
when :reject_if => :all_blank is supplied | |
when all attributes are blank | |
does not add the new document | |
when an attribute is non-empty | |
adds the new document | |
sets the correct attributes | |
when destroy attributes are passed | |
when allow_destroy is true | |
when passed a 1 with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a 1 with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a true with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a true with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when allow destroy is false | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when allow destroy is not defined | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when the relation is a references many to many | |
when a limit is specified | |
when more are provided than the limit | |
raises an error | |
when less are provided than the limit | |
sets the documents on the relation | |
when ids are passed | |
when no destroy attributes are passed | |
when the ids match | |
when reloading the document | |
updates the first existing document | |
updates the second existing document | |
does not add new documents | |
when the ids do not match | |
raises an error | |
when destroy attributes are passed | |
when the ids match | |
when allow_destroy is true | |
when passed a 1 with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a 1 with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a true with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a true with destroy | |
when reloading the documents | |
deletes the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the document | |
does not delete the marked document | |
does not delete the unmarked document | |
when allow_destroy is false | |
when passed a 1 with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 1 with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading the document | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 0 with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading the documents | |
does not delete the marked document | |
does not delete the unmarked document | |
when allow_destroy is undefined | |
when passed a 1 with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 1 with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a true with destroy | |
when reloading | |
does not ignore the marked document | |
does not delete the unmarked document | |
does not add additional documents | |
when passed a 0 with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a 0 with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when passed a false with destroy | |
when reloading | |
does not delete the marked document | |
does not delete the unmarked document | |
when no ids are passed | |
when no destroy attributes are passed | |
builds a new first document | |
builds a new second document | |
builds a new third document | |
does not add extra documents | |
adds the documents in the sorted hash key order | |
when a reject block is supplied | |
when the attributes match | |
does not add the new document | |
when the attributes do not match | |
adds the new document | |
sets the correct attributes | |
when :reject_if => :all_blank is supplied | |
when all attributes are empty | |
does not add the new document | |
when an attribute is non-empty | |
adds the new document | |
sets the correct attributes | |
when destroy attributes are passed | |
when allow_destroy is true | |
when passed a 1 with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a 1 with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a true with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a true with destroy | |
ignores the the marked document | |
adds the new unmarked document | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when allow destroy is false | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when allow destroy is not defined | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 1 with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a true with destroy | |
adds the the marked document | |
adds the new unmarked document | |
adds the correct number of documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a 0 with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
when passed a false with destroy | |
adds the new marked document | |
adds the new unmarked document | |
does not add extra documents | |
Mongoid::Paranoia | |
a soft deleted item | |
should have a deletion date | |
should be restorable | |
should be invisible to searches | |
should be found using the deleted named scope | |
should be hard-destroyable | |
Mongoid::Persistence::Insert | |
#persist | |
when the document is not embedded | |
runs the before_create callback once | |
when the document is embedded | |
runs the before_create callback once | |
Mongoid::Persistence::Update | |
#persist | |
when the document has changed | |
updates the document in the database | |
when the document has not changed | |
returns true | |
Mongoid::Persistence | |
.create | |
when providing attributes | |
it saves the document | |
returns the document | |
on an embedded document | |
should be persisted | |
should be a kind of Address | |
when passing in a block | |
sets the attributes | |
persists the document | |
.create! | |
inserting with a field that is not unique | |
when a unique index exists | |
raises an error | |
when passing in a block | |
sets the attributes | |
persists the document | |
when setting the composite key | |
saves the document | |
#delete | |
when removing a root document | |
deletes the document from the collection | |
returns true | |
when removing an embedded document | |
when the document is not yet saved | |
removes the document from the parent | |
removes the attributes from the parent | |
when the document has been saved | |
removes the object from the parent and database | |
when removing deeply embedded documents | |
when the document has been saved | |
removes the object from the parent and database | |
#destroy | |
when removing a root document | |
deletes the document from the collection | |
returns true | |
when removing an embedded document | |
when the document is not yet saved | |
removes the document from the parent | |
removes the attributes from the parent | |
when the document has been saved | |
removes the object from the parent and database | |
when removing deeply embedded documents | |
when the document has been saved | |
removes the object from the parent and database | |
#save | |
when validation passes | |
returns true | |
when validation fails | |
has the appropriate errors | |
when modifying the entire hierarchy | |
when performing modification and insert ops | |
saves the root document | |
saves embedded many relations | |
saves embedded one relations | |
persists with proper set and push modifiers | |
when combining modifications and pushes | |
saves modifications to existing embedded docs | |
saves modifications to new embedded docs | |
saves modifications to deeply embedded docs | |
when removing elements without using delete or destroy | |
saves the hierarchy | |
save! | |
inserting with a field that is not unique | |
when a unique index exists | |
raises an error | |
#update_attribute | |
when provided a symbol attribute name | |
when the document is valid | |
sets the attribute | |
saves the document | |
when the document is invalid | |
sets the attribute | |
saves the document | |
when provided a string attribute name | |
when the document is valid | |
sets the attribute | |
saves the document | |
when the document is invalid | |
sets the attribute | |
saves the document | |
#update_attributes | |
when validation passes | |
returns true | |
saves the attributes | |
when updating through a one-to-one relation | |
saves the attributes | |
on a new record | |
saves the new record | |
when passing in a relation | |
when providing a parent to a referenced in | |
when the relation has not yet been touched | |
sets the instance of the relation | |
sets properly through method_missing | |
persists the reference | |
when the relation has been touched | |
sets the instance of the relation | |
sets properly through method_missing | |
persists the reference | |
#delete_all | |
removes all the documents | |
returns the number of documents removed | |
#destroy_all | |
removes all the documents | |
returns the number of documents removed | |
Mongoid::Relations::Accessors | |
#{getter} | |
when the relation is not polymorphic | |
when the relation is a many to many | |
when reloading the relation directly | |
reloads the correct documents | |
reloads a new instance | |
when reloading via the base document | |
reloads the correct documents | |
reloads a new instance | |
when performing a fresh find on the base | |
reloads the correct documents | |
when the relation is a many to one | |
when reloading the relation directly | |
reloads the correct documents | |
reloads a new instance | |
when reloading via the base document | |
reloads the correct documents | |
reloads a new instance | |
when performing a fresh find on the base | |
reloads the correct documents | |
when the relation is a references one | |
when reloading the relation directly | |
reloads the correct documents | |
reloads a new instance | |
when reloading via the base document | |
reloads the correct documents | |
reloads a new instance | |
when performing a fresh find on the base | |
reloads the correct documents | |
when the relation is polymorphic | |
when accessing a referenced in | |
returns the correct type | |
returns the correct document | |
when accessing a references many | |
returns the correct documents | |
when accessing a references one | |
returns the correct document | |
Mongoid::Relations::AutoSave | |
.auto_save | |
when the option is not provided | |
when saving the parent document | |
does not save the relation | |
when the option is true | |
when the relation is a references many | |
when saving a new parent document | |
saves the relation | |
when saving an existing parent document | |
does not save the relation | |
when the relation is a references one | |
when saving a new parent document | |
saves the relation | |
when saving an existing parent document | |
does not save the relation | |
Mongoid::Relations::Builders::Referenced::In | |
#build | |
when no document found in the database | |
when the id is nil | |
returns nil | |
when the id is incorrect | |
returns nil | |
Mongoid::Relations::Builders::Referenced::Many | |
#build | |
when no documents found in the database | |
when the ids are empty | |
returns an empty array | |
Mongoid::Relations::Builders::Referenced::ManyToMany | |
#build | |
Github 246: Should return documents in same order as ids (PENDING: Not Yet Implemented) | |
when no documents found in the database | |
when the ids are empty | |
returns an empty array | |
when the ids are incorrect | |
returns an empty array | |
Mongoid::Relations::Builders::Referenced::One | |
#build | |
when the document is not found | |
returns nil | |
Mongoid::Relations::Cascading | |
#delete | |
when cascading removals | |
when dependent is delete | |
deletes the associated documents | |
when dependent is destroy | |
destroys the associated documents | |
when dependent is nullify | |
when nullifying a references many | |
removes the references to the removed document | |
when nullifying a references one | |
when the relation exists | |
removes the references to the removed document | |
when the relation is nil | |
returns nil | |
when nullifying a many to many | |
removes the references from the removed document | |
removes the references to the removed document | |
#destroy | |
when cascading removals | |
when dependent is delete | |
deletes the associated documents | |
when dependent is destroy | |
destroys the associated documents | |
when dependent is nullify | |
when nullifying a references many | |
removes the references to the removed document | |
when nullifying a references one | |
when the relation exists | |
removes the references to the removed document | |
when the relation is nil | |
returns nil | |
when nullifying a many to many | |
removes the references from the removed document | |
removes the references to the removed document | |
Mongoid::Relations::Embedded::In | |
when creating the tree through initialization | |
saves the child | |
indexes the child | |
saves the first location with the correct index | |
saves the second location with the correct index | |
has the locations in the association array | |
when instantiating a new child with a persisted parent | |
does not save the child | |
does not save the deeply embedded children | |
#= | |
when the inverse of an embeds one | |
when the child is a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the base | |
when the inverse of an embeds many | |
when the child is a new record | |
sets the target of the relation | |
appends the base on the inverse relation | |
sets the same instance in the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the same instance in the inverse relation | |
appends the base on the inverse relation | |
#= nil | |
when the inverse of an embeds one | |
when the parent is a new record | |
sets the relation to nil | |
removes the inverse relation | |
when the inverse is already nil | |
sets the relation to nil | |
removes the inverse relation | |
when the documents are not new records | |
sets the relation to nil | |
removed the inverse relation | |
deletes the child document | |
when the inverse of an embeds many | |
when the parent is a new record | |
sets the relation to nil | |
removes the inverse relation | |
when the inverse is already nil | |
sets the relation to nil | |
when the documents are not new records | |
sets the relation to nil | |
removed the inverse relation | |
deletes the child document | |
when a child already exists on the parent | |
sets the relation to nil | |
removed the inverse relation | |
deletes the child document | |
reindexes the children | |
Mongoid::Relations::Embedded::Many | |
when validating the parent before accessing the child | |
when saving | |
does not lose the parent reference | |
when updating attributes | |
does not lose the parent reference | |
#<< | |
when the parent is a new record | |
appends to the target | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the new document | |
when the parent and child have a cyclic relation | |
when the parent is a new record | |
appends to the target | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the new document | |
#push | |
when the parent is a new record | |
appends to the target | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the new document | |
when the parent and child have a cyclic relation | |
when the parent is a new record | |
appends to the target | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the new document | |
#concat | |
when the parent is a new record | |
appends to the target | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the new document | |
when the parent and child have a cyclic relation | |
when the parent is a new record | |
appends to the target | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the new document | |
#= | |
when the parent is a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the target | |
when replacing an existing relation | |
deletes the old documents | |
when the relation has an unusual name | |
allows creation of the embedded document | |
saves the relation | |
remains on reload | |
when the relation has address in the name | |
requires an inflection to determine the class | |
when the parent and child have a cyclic relation | |
when the parent is a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
when the parent is not a new record | |
saves the target | |
#= nil | |
when the relationship is polymorphic | |
when the parent is a new record | |
sets the relation to empty | |
removes the inverse relation | |
when the inverse is already nil | |
sets the relation to empty | |
when the documents are not new records | |
sets the relation to empty | |
removed the inverse relation | |
deletes the child document | |
when the relationship is cyclic | |
when the parent is a new record | |
sets the relation to empty | |
removes the inverse relation | |
when the inverse is already nil | |
sets the relation to empty | |
when the documents are not new records | |
sets the relation to empty | |
removed the inverse relation | |
deletes the child document | |
#build | |
when the relation is not cyclic | |
appends to the target | |
sets the base on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
writes to the attributes | |
when the relation is cyclic | |
appends to the target | |
sets the base on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
writes to the attributes | |
#build | |
when the relation is not cyclic | |
appends to the target | |
sets the base on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
writes to the attributes | |
when the relation is cyclic | |
appends to the target | |
sets the base on the inverse relation | |
does not save the new document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
writes to the attributes | |
#clear | |
when the parent has been persisted | |
when the children are persisted | |
clears out the relation | |
marks the documents as deleted | |
deletes the documents from the db | |
returns the relation | |
when the children are not persisted | |
clears out the relation | |
when the parent is not persisted | |
clears out the relation | |
#count | |
returns the number of persisted documents | |
#create | |
appends to the target | |
sets the base on the inverse relation | |
saves the document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
writes to the attributes | |
when embedding a multi word named document | |
saves the embedded document | |
#create! | |
when validation passes | |
appends to the target | |
sets the base on the inverse relation | |
saves the document | |
sets the parent on the child | |
sets the metadata on the child | |
sets the index on the child | |
writes to the attributes | |
when validation fails | |
raises an error | |
#delete | |
when the document exists in the relation | |
deletes the document | |
reindexes the relation | |
returns the document | |
when the document does not exist | |
returns nil | |
#delete_all | |
when the documents are new | |
when conditions are provided | |
removes the matching documents | |
returns the number deleted | |
when conditions are not provided | |
removes all documents | |
returns the number deleted | |
when the documents persisted | |
when conditions are provided | |
deletes the matching documents from the db | |
returns the number deleted | |
when conditions are not provided | |
deletes all the documents from the db | |
returns the number deleted | |
when removing and resaving | |
removes the documents | |
allows addition and a resave | |
#destroy_all | |
when the documents are new | |
when conditions are provided | |
removes the matching documents | |
returns the number deleted | |
when conditions are not provided | |
removes all documents | |
returns the number deleted | |
when the documents persisted | |
when conditions are provided | |
deletes the matching documents from the db | |
returns the number deleted | |
when conditions are not provided | |
deletes all the documents from the db | |
returns the number deleted | |
when removing and resaving | |
removes the documents | |
allows addition and a resave | |
#exists? | |
when documents exist in the database | |
returns true | |
when no documents exist in the database | |
returns false | |
#find | |
when providing an id | |
when the id matches | |
returns the matching document | |
when the id does not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns nil | |
when providing an array of ids | |
when the ids match | |
returns the matching documents | |
when the ids do not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns an empty array | |
when finding first | |
when there is a match | |
returns the first matching document | |
when there is no match | |
returns nil | |
when finding last | |
when there is a match | |
returns the last matching document | |
when there is no match | |
returns nil | |
when finding all | |
when there is a match | |
returns the matching documents | |
when there is no match | |
returns an empty array | |
#find_or_create_by | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a newly persisted document | |
#find_or_initialize_by | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a non persisted document | |
#method_missing | |
when providing a single criteria | |
applies the criteria to the documents | |
when providing a criteria class method | |
applies the criteria to the documents | |
when chaining criteria | |
applies the criteria to the documents | |
when delegating methods | |
#distinct | |
returns the distinct values for the fields | |
#paginate | |
when provided page and per page options | |
returns the correct number of documents | |
returns the supplied page of documents | |
#size | |
returns the number of persisted documents | |
#length | |
returns the number of persisted documents | |
when deeply embedding documents | |
when building the tree through pushes | |
sets up the hierarchy | |
when building the tree through builds | |
sets up the hierarchy | |
when creating a persisted tree | |
sets up the hierarchy | |
when reloading | |
reloads the entire tree | |
Mongoid::Relations::Embedded::One | |
#= | |
when the relation is not cyclic | |
when the parent is a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
when the relation is cyclic | |
when the parent is a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
#= nil | |
when the relation is not cyclic | |
when the parent is a new record | |
sets the relation to nil | |
removes the inverse relation | |
when the inverse is already nil | |
sets the relation to nil | |
when the documents are not new records | |
sets the relation to nil | |
removed the inverse relation | |
deletes the child document | |
when the relation is cyclic | |
when the parent is a new record | |
sets the relation to nil | |
removes the inverse relation | |
when the inverse is already nil | |
sets the relation to nil | |
when the documents are not new records | |
sets the relation to nil | |
removed the inverse relation | |
deletes the child document | |
#build_#{name} | |
when the relation is not cyclic | |
when the parent is a new record | |
when not providing any attributes | |
when building once | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets no attributes | |
does not save the target | |
when building twice | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets no attributes | |
does not save the target | |
when passing nil as the attributes | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets no attributes | |
does not save the target | |
when providing attributes | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
when the parent is not a new record | |
does not save the target | |
when the relation is cyclic | |
when the parent is a new record | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
when the parent is not a new record | |
does not save the target | |
#create_#{name} | |
when the parent is a new record | |
when not providing any attributes | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets no attributes | |
saves the target | |
when passing nil as the attributes | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets no attributes | |
saves the target | |
when providing attributes | |
sets the target of the relation | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
when the parent is not a new record | |
does not save the target | |
Mongoid::Relations::Referenced::In | |
#= | |
when the inverse relation has no reference defined | |
sets the relation | |
sets the foreign_key | |
when referencing a document from an embedded document | |
sets the relation | |
does not erase the metadata | |
allows saving of the embedded document | |
when the parent is a references one | |
when the relation is not polymorphic | |
when the child is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the child is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not saves the target | |
when the relation is not polymorphic | |
when the child is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the child is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not saves the target | |
when the parent is a references many | |
when the relation is not polymorphic | |
when the child is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the child is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not saves the target | |
when the relation is polymorphic | |
when the child is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
does not save the target | |
when the child is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
does not saves the target | |
#= nil | |
when the inverse relation has no reference defined | |
removes the relation | |
removes the foreign_key | |
when the parent is a references one | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
does not delete the child | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is a references many | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
Mongoid::Relations::Referenced::Many | |
#<< | |
when the relations are not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
adds the document to the target | |
when the relations are polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
saves the target | |
adds the document to the target | |
#push | |
when the relations are not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
adds the document to the target | |
when the relations are polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
saves the target | |
adds the document to the target | |
#concat | |
when the relations are not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
adds the document to the target | |
when the relations are polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
saves the target | |
adds the document to the target | |
#= | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
saves the target | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
saves the target | |
#= nil | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the relation to an empty array | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to empty | |
removed the inverse relation | |
removes the foreign key value | |
deletes the target from the database | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the relation to an empty array | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to empty | |
removed the inverse relation | |
removes the foreign key value | |
deletes the target from the database | |
#build | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
does not perform validation | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
does not perform validation | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
#build | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
does not perform validation | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
does not perform validation | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
#clear | |
when the relation is not polymorphic | |
when the parent has been persisted | |
when the children are persisted | |
clears out the relation | |
marks the documents as deleted | |
deletes the documents from the db | |
returns the relation | |
when the children are not persisted | |
clears out the relation | |
when the parent is not persisted | |
clears out the relation | |
when the relation is polymorphic | |
when the parent has been persisted | |
when the children are persisted | |
clears out the relation | |
marks the documents as deleted | |
deletes the documents from the db | |
returns the relation | |
when the children are not persisted | |
clears out the relation | |
when the parent is not persisted | |
clears out the relation | |
#count | |
when documents have been persisted | |
returns the number of persisted documents | |
when documents have not been persisted | |
returns 0 | |
when new documents exist in the database | |
when the documents are part of the relation | |
returns the count from the db | |
when the documents are not part of the relation | |
returns the count from the db | |
#create | |
when the relation is not polymorphic | |
when the parent is a new record | |
raises an unsaved document error | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
adds the document to the target | |
when the relation is polymorphic | |
when the parent is a new record | |
raises an unsaved document error | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
adds the document to the target | |
#create! | |
when the relation is not polymorphic | |
when the parent is a new record | |
raises an unsaved document error | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
adds the document to the target | |
when validation fails | |
raises an error | |
when the relation is polymorphic | |
when the parent is a new record | |
raises an unsaved document error | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
adds the document to the target | |
when validation fails | |
raises an error | |
#delete_all | |
when the relation is not polymorphic | |
when conditions are provided | |
removes the correct posts | |
deletes the documents from the database | |
returns the number of documents deleted | |
when conditions are not provided | |
removes the correct posts | |
deletes the documents from the database | |
returns the number of documents deleted | |
when the relation is polymorphic | |
when conditions are provided | |
removes the correct ratings | |
deletes the documents from the database | |
returns the number of documents deleted | |
when conditions are not provided | |
removes the correct ratings | |
deletes the documents from the database | |
returns the number of documents deleted | |
#destroy_all | |
when the relation is not polymorphic | |
when conditions are provided | |
removes the correct posts | |
deletes the documents from the database | |
returns the number of documents deleted | |
when conditions are not provided | |
removes the correct posts | |
deletes the documents from the database | |
returns the number of documents deleted | |
when the relation is polymorphic | |
when conditions are provided | |
removes the correct ratings | |
deletes the documents from the database | |
returns the number of documents deleted | |
when conditions are not provided | |
removes the correct ratings | |
deletes the documents from the database | |
returns the number of documents deleted | |
#exists? | |
when documents exist in the database | |
returns true | |
when no documents exist in the database | |
returns false | |
#find | |
when the relation is not polymorphic | |
when providing an id | |
when the id matches | |
returns the matching document | |
when the id matches but is not scoped to the relation | |
raises an error | |
when the id does not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns nil | |
when providing an array of ids | |
when the ids match | |
returns the matching documents | |
when the ids do not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns an empty array | |
when finding first | |
when there is a match | |
returns the first matching document | |
when there is no match | |
returns nil | |
when finding last | |
when there is a match | |
returns the last matching document | |
when there is no match | |
returns nil | |
when finding all | |
when there is a match | |
returns the matching documents | |
when there is no match | |
returns an empty array | |
when the relation is polymorphic | |
when providing an id | |
when the id matches | |
returns the matching document | |
when the id does not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns nil | |
when providing an array of ids | |
when the ids match | |
returns the matching documents | |
when the ids do not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns an empty array | |
when finding first | |
when there is a match | |
returns the first matching document | |
when there is no match | |
returns nil | |
when finding last | |
when there is a match | |
returns the last matching document | |
when there is no match | |
returns nil | |
when finding all | |
when there is a match | |
returns the matching documents | |
when there is no match | |
returns an empty array | |
#find_or_create_by | |
when the relation is not polymorphic | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a newly persisted document | |
when the relation is polymorphic | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a newly persisted document | |
#find_or_initialize_by | |
when the relation is not polymorphic | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a non persisted document | |
when the relation is polymorphic | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a non persisted document | |
#method_missing | |
when providing a single criteria | |
applies the criteria to the documents | |
when providing a criteria class method | |
applies the criteria to the documents | |
when chaining criteria | |
applies the criteria to the documents | |
when delegating methods | |
#distinct | |
returns the distinct values for the fields | |
#nullify_all | |
when the relation is not polymorphic | |
removes all the foreign keys from the target | |
removes all the references from the target | |
saves the documents | |
when the relation is polymorphic | |
removes all the foreign keys from the target | |
removes all the references from the target | |
#size | |
when documents have been persisted | |
returns 0 | |
when documents have not been persisted | |
returns the total number of documents | |
#length | |
when documents have been persisted | |
returns 0 | |
when documents have not been persisted | |
returns the total number of documents | |
Mongoid::Relations::Referenced::ManyToMany | |
#<< | |
when the relations are not polymorphic | |
when the inverse relation is not defined | |
appends the document to the relation | |
sets the foreign key on the relation | |
when the parent is a new record | |
adds the documents to the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
adds the correct number of documents | |
when the parent is not a new record | |
adds the documents to the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
adds the document to the target | |
#push | |
when the relations are not polymorphic | |
when the inverse relation is not defined | |
appends the document to the relation | |
sets the foreign key on the relation | |
when the parent is a new record | |
adds the documents to the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
adds the correct number of documents | |
when the parent is not a new record | |
adds the documents to the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
adds the document to the target | |
#concat | |
when the relations are not polymorphic | |
when the inverse relation is not defined | |
appends the document to the relation | |
sets the foreign key on the relation | |
when the parent is a new record | |
adds the documents to the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
adds the correct number of documents | |
when the parent is not a new record | |
adds the documents to the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
adds the document to the target | |
#= | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the relation | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
sets the base on the inverse relation | |
saves the target | |
when overwriting an existing relation | |
sets the relation | |
saves the target | |
does not leave foreign keys of the previous relation | |
#= nil | |
when the relation is not polymorphic | |
when the inverse relation is not defined | |
clears the relation | |
clears the foreign keys | |
when the parent is a new record | |
sets the relation to an empty array | |
removed the inverse relation | |
removes the foreign key values | |
removes the inverse foreign key values | |
when the parent is not a new record | |
sets the relation to an empty array | |
removed the inverse relation | |
removes the foreign key values | |
removes the inverse foreign key values | |
deletes the target from the database | |
#build | |
when the relation is not polymorphic | |
when the parent is a new record | |
adds the document to the relation | |
sets the foreign key on the relation | |
sets the inverse foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the correct number of documents | |
when the parent is not a new record | |
adds the document to the relation | |
sets the foreign key on the relation | |
sets the inverse foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the correct number of documents | |
#new | |
when the relation is not polymorphic | |
when the parent is a new record | |
adds the document to the relation | |
sets the foreign key on the relation | |
sets the inverse foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the correct number of documents | |
when the parent is not a new record | |
adds the document to the relation | |
sets the foreign key on the relation | |
sets the inverse foreign key on the relation | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the correct number of documents | |
#clear | |
when the relation is not polymorphic | |
when the parent has been persisted | |
when the children are persisted | |
clears out the relation | |
removes the parent from the inverse relation | |
removes the foreign keys | |
removes the parent key from the inverse | |
marks the documents as deleted | |
deletes the documents from the db | |
returns the relation | |
when the children are not persisted | |
clears out the relation | |
when the parent is not persisted | |
clears out the relation | |
#count | |
when documents have been persisted | |
returns the number of persisted documents | |
when documents have not been persisted | |
returns 0 | |
when new documents exist in the database | |
when the documents are part of the relation | |
returns the count from the db | |
when the documents are not part of the relation | |
returns the count from the db | |
#create | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
adds the document | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
adds the document | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
adds the document to the target | |
#create! | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
adds the document | |
sets the base on the inverse relation | |
sets the attributes | |
does not save the target | |
adds the document to the target | |
when the parent is not a new record | |
sets the foreign key on the relation | |
sets the foreign key on the inverse relation | |
adds the document | |
sets the base on the inverse relation | |
sets the attributes | |
saves the target | |
adds the document to the target | |
#create! | |
when validation fails | |
when the relation is not polymorphic | |
raises an error | |
#delete | |
when the document exists | |
removes the document from the relation | |
returns the document | |
removes the document key from the foreign key | |
removes the inverse reference | |
removes the base id from the inverse keys | |
when the document does not exist | |
returns nil | |
does not modify the relation | |
does not modify the keys | |
#delete_all | |
when the relation is not polymorphic | |
when conditions are provided | |
removes the correct preferences | |
deletes the documents from the database | |
returns the number of documents deleted | |
when conditions are not provided | |
removes the correct preferences | |
deletes the documents from the database | |
returns the number of documents deleted | |
#destroy_all | |
when the relation is not polymorphic | |
when conditions are provided | |
removes the correct preferences | |
deletes the documents from the database | |
returns the number of documents deleted | |
when conditions are not provided | |
removes the correct preferences | |
deletes the documents from the database | |
returns the number of documents deleted | |
#exists? | |
when documents exist in the database | |
returns true | |
when no documents exist in the database | |
returns false | |
#find | |
when the relation is not polymorphic | |
when providing an id | |
when the id matches | |
returns the matching document | |
when the id matches but is not scoped to the relation | |
raises an error | |
when the id does not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns nil | |
when providing an array of ids | |
when the ids match | |
returns the matching documents | |
when the ids do not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns an empty array | |
when finding first | |
when there is a match | |
returns the first matching document | |
when there is no match | |
returns nil | |
when finding last | |
when there is a match | |
returns the last matching document | |
when there is no match | |
returns nil | |
when finding all | |
when there is a match | |
returns the matching documents | |
when there is no match | |
returns an empty array | |
#find_or_create_by | |
when the relation is not polymorphic | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a newly persisted document | |
#find_or_initialize_by | |
when the relation is not polymorphic | |
when the document exists | |
returns the document | |
when the document does not exist | |
sets the new document attributes | |
returns a non persisted document | |
#method_missing | |
when providing a single criteria | |
applies the criteria to the documents | |
when providing a criteria class method | |
applies the criteria to the documents | |
when chaining criteria | |
applies the criteria to the documents | |
when delegating methods | |
#distinct | |
returns the distinct values for the fields | |
#nullify_all | |
removes the foreign key from the base document | |
removes the foreign key from the target documents | |
removes the reference from the base document | |
removes the reference from the target documents | |
saves the documents | |
#size | |
when documents have been persisted | |
returns the number of documents | |
when documents have not been persisted | |
returns the total number of documents | |
#length | |
when documents have been persisted | |
returns the number of documents | |
when documents have not been persisted | |
returns the total number of documents | |
Mongoid::Relations::Referenced::One | |
#= | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the target of the relation | |
sets the foreign key on the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
does not save the target | |
when the parent is not a new record | |
sets the target of the relation | |
sets the foreign key of the relation | |
sets the base on the inverse relation | |
sets the same instance on the inverse relation | |
saves the target | |
#= nil | |
when the relation is not polymorphic | |
when the parent is a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
deletes the target from the database | |
when the relation is polymorphic | |
when the parent is a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
when the parent is not a new record | |
sets the relation to nil | |
removed the inverse relation | |
removes the foreign key value | |
deletes the target from the database | |
#build_#{name} | |
when the relation is not polymorphic | |
when using object ids | |
returns a new document | |
sets the foreign key on the document | |
sets the inverse relation | |
does not save the built document | |
when providing no attributes | |
sets the foreign key on the document | |
sets the inverse relation | |
does not save the built document | |
when providing nil attributes | |
sets the foreign key on the document | |
sets the inverse relation | |
does not save the built document | |
when the relation is polymorphic | |
when using object ids | |
returns a new document | |
sets the foreign key on the document | |
sets the inverse relation | |
does not save the built document | |
#create_#{name} | |
when the relation is not polymorphic | |
returns a new document | |
sets the foreign key on the document | |
sets the inverse relation | |
saves the document | |
when providing no attributes | |
sets the foreign key on the document | |
sets the inverse relation | |
saves the document | |
when providing nil attributes | |
sets the foreign key on the document | |
sets the inverse relation | |
saves the document | |
when the relation is polymorphic | |
returns a new document | |
sets the foreign key on the document | |
sets the inverse relation | |
saves the document | |
#nullify | |
removes the foreign key from the target | |
removes the reference from the target | |
removes the reference from the base | |
Mongoid::Safety | |
when global safe mode is false | |
.create | |
inserts the document | |
overrides the global config option | |
Mongoid::Serialization | |
#serializable_hash | |
when including relations | |
when including a single relation | |
when including an embeds many | |
when providing the include as a symbol | |
includes the first relation | |
includes the second relation | |
when providing the include as an array | |
includes the first relation | |
includes the second relation | |
when providing the include as a hash | |
when including one level deep | |
includes the first relation sans exceptions | |
includes the second relation sans exceptions | |
when including multiple levels deep | |
includes the specified relation | |
when defining a default exclusion | |
does not contain the root exclusion | |
does not include the embedded many exclusion | |
does not include the embedded one exclusion | |
when including an embeds one | |
when providing the include as a symbol | |
includes the specified relation | |
when providing the include as an array | |
includes the specified relation | |
when providing the include as a hash | |
includes the specified relation sans exceptions | |
when including a references many | |
when providing the include as a symbol | |
includes the specified relation | |
includes the first document related fields | |
includes the second document related fields | |
when providing the include as an array | |
includes the specified relation | |
includes the first document related fields | |
includes the second document related fields | |
when providing the include as a hash | |
includes the specified relation | |
includes the first document related fields | |
includes the second document related fields | |
does not include the first document exceptions | |
does not include the second document exceptions | |
when including a references many to many | |
when providing the include as a symbol | |
includes the specified relation | |
includes the first document related fields | |
includes the second document related fields | |
when providing the include as an array | |
includes the specified relation | |
includes the first document related fields | |
includes the second document related fields | |
when providing the include as a hash | |
includes the specified relation | |
includes the first document related fields | |
includes the second document related fields | |
does not include the first document exceptions | |
does not include the second document exceptions | |
does not include the root exceptions | |
#to_json | |
when including root in json | |
uses the mongoid configuration | |
when not including root in json | |
uses the mongoid configuration | |
#to_xml | |
when an Array field is defined | |
properly types the array | |
serializes the array | |
when a Hash field is defined | |
properly types the hash | |
serializes the hash | |
Mongoid::Validations::AssociatedValidator | |
#valid? | |
when validating associated on both sides | |
when the documents are valid | |
only validates the parent once | |
only validates the child once | |
when the documents are not valid | |
only validates the parent once | |
adds the errors from the relation | |
only validates the child once | |
Mongoid::Validations::UniquenessValidator | |
#valid? | |
when the document has no composite keys defined | |
when no documents are saved | |
returns true | |
when documents exist in the database | |
when the document is not new | |
returns true | |
when there is a field conflict | |
returns false | |
when there is a field similarity | |
returns true | |
when there is a case insensitive conflict | |
returns false | |
when providing escapable characters | |
returns true | |
when document is new | |
when there is a uniqueness conflict | |
returns false | |
contains uniqueness errors | |
when there is a case insensitive conflict | |
returns false | |
when providing escapable characters | |
returns true | |
when the document has keys defined | |
when no record in the database | |
passes validation | |
with a record in the database | |
when the document is new | |
fails validation | |
contains uniqueness errors | |
when the document is not new | |
when the key has changed | |
fails validation | |
when the key has not changed | |
passes validation | |
when the parent document embeds_many | |
when no record in the database | |
passes validation | |
with a record in the database | |
when document is not new | |
passes validation | |
fails validation when another document has the same unique field | |
with case insensitive validation | |
fails validation when another document has the same unique field with a different case | |
when document is new | |
fails validation | |
contains uniqueness errors | |
with case insensitive validation | |
fails validation when another document has the same unique field with a different case | |
when the parent document embeds_one | |
passes validation | |
when replacing with a new record with the same value | |
passes validation | |
Mongoid::Validations | |
#valid? | |
when provided a context | |
uses the provided context | |
when not provided a context | |
when the document is new | |
defaults the context to :create | |
when the document is persisted | |
defaults the context to :update | |
Mongoid::Versioning | |
#version | |
when the document is new | |
defaults to 1 | |
after the document's first save | |
returns 1 | |
when saving multiple times | |
increments the version by 1 | |
#versions | |
when version is less than the maximum | |
retains all versions | |
retains the correct values | |
when version is over the maximum | |
retains the set number of most recent versions | |
retains the most recent values | |
Mongoid::Atomicity | |
#_updates | |
when the document is persisted | |
when the document is modified | |
returns the atomic updates | |
when an embeds many child is added | |
returns a $set and $pushAll for modifications | |
when an embeds one child is added | |
returns a $set for modifications | |
when an existing embeds many gets modified | |
returns the $set with correct position and modifications | |
when an existing 2nd level embedded child gets modified | |
returns the $set with correct positions and modifications | |
when a 2nd level embedded child gets added | |
returns the $set with correct positions and modifications | |
when adding a new second level child | |
returns the $set for 1st level and other for the 2nd level | |
when adding new embedded docs at multiple levels | |
returns the proper $sets and $pushAlls for all levels | |
Mongoid::Attributes | |
#[] | |
when attribute does not exist | |
returns the default value | |
when attribute is not accessible | |
returns the value | |
#[]= | |
when setting the attribute to nil | |
does not use the default value | |
when field has a default value | |
should allow overwriting of the default value | |
.attr_accessible | |
when the field is not _id | |
prevents setting via mass assignment | |
when the field is _id | |
prevents setting via mass assignment | |
when using instantiate | |
ignores any protected attribute | |
.attr_protected | |
when the field is not _id | |
prevents setting via mass assignment | |
when the field is _id | |
prevents setting via mass assignment | |
when using instantiate | |
ignores any protected attribute | |
#_id | |
delegates to #id | |
#_id= | |
when using object ids | |
when providing an object id | |
sets the id as the object id | |
when providing a string | |
sets the id as the object id | |
when providing an integer | |
sets the id as the supplied value to_s | |
when using string ids | |
when providing an object id | |
sets the id as the string of the object id | |
when providing a string | |
sets the id as the string | |
when providing an integer | |
sets the id as the supplied value to_s | |
when using integer ids | |
when providing a string | |
sets the id as the integer | |
when providing an integer | |
sets the id as the supplied value | |
#method_missing | |
when an attribute exists | |
allows the getter | |
allows the setter | |
returns true for respond_to? | |
#process | |
when passing non accessible fields | |
does not set the value | |
when attributes dont have fields defined | |
when allowing dynamic fields | |
when attribute is a string | |
adds the string to the attributes | |
when attribute is not a string | |
adds a cast value to the attributes | |
when not allowing dynamic fields | |
raises an error | |
when supplied hash has string values | |
casts integers | |
casts booleans | |
casts ids | |
sets empty strings to nil | |
when associations provided in the attributes | |
when association is a has_one | |
sets the associations | |
when association is a references_one | |
sets the associations | |
when association is a embedded_in | |
sets the association | |
when non-associations provided in the attributes | |
calls the setter for the association | |
when an empty array is provided in the attributes | |
sets the empty array | |
when an empty hash is provided in the attributes | |
sets the empty hash | |
updating when attributes already exist | |
only overwrites supplied attributes | |
#read_attribute | |
when attribute does not exist | |
returns the default value | |
when attribute is not accessible | |
returns the value | |
#attribute_present? | |
when attribute does not exist | |
returns false | |
when attribute does exist | |
returns true | |
#remove_attribute | |
when the attribute exists | |
removes the attribute | |
when the attribute does not exist | |
does nothing | |
#write_attribute | |
when attribute does not exist | |
returns the default value | |
when setting the attribute to nil | |
does not use the default value | |
when field has a default value | |
should allow overwriting of the default value | |
#typed_value_for | |
when the key has been specified as a field | |
retuns the typed value | |
when the key has not been specified as a field | |
returns the value | |
#default_attributes | |
typecasts proc values | |
#attributes= | |
typecasting | |
properly casts values | |
allows passing of nil | |
on a parent document | |
when the parent has a has many through a has one | |
does not overwrite child attributes if not in the hash | |
on a child document | |
when child is part of a has one | |
sets the child attributes on the parent | |
when child is part of a has many | |
updates the child attributes on the parent | |
#write_attributes | |
typecasting | |
properly casts values | |
allows passing of nil | |
on a parent document | |
when the parent has a has many through a has one | |
does not overwrite child attributes if not in the hash | |
on a child document | |
when child is part of a has one | |
sets the child attributes on the parent | |
when child is part of a has many | |
updates the child attributes on the parent | |
Mongoid::Callbacks | |
.included | |
includes the before_create callback | |
includes the after_create callback | |
includes the before_destroy callback | |
includes the after_destroy callback | |
includes the before_save callback | |
includes the after_save callback | |
includes the before_update callback | |
includes the after_update callback | |
includes the before_validation callback | |
includes the after_validation callback | |
includes the after_initialize callback | |
.after_initialize | |
runs after document instantiation | |
.before_create | |
callback returns true | |
should get saved | |
callback returns false | |
should not get saved | |
Mongoid::Collection | |
Mongo::Collection write operations | |
defines << | |
defines create_index | |
defines drop | |
defines drop_index | |
defines drop_indexes | |
defines insert | |
defines remove | |
defines rename | |
defines save | |
defines update | |
Mongo::Collection read operations | |
defines [] | |
defines db | |
defines count | |
defines distinct | |
defines find | |
defines find_one | |
defines group | |
defines index_information | |
defines map_reduce | |
defines mapreduce | |
defines stats | |
defines options | |
master and slave | |
when the database is named | |
should use the named database master | |
should use the named database slaves | |
#directed | |
when an enslave option is not passed | |
uses the default | |
when an enslave option is passed | |
overwrites the default | |
when cached option is passed | |
removed the cache option | |
#find | |
when no block supplied | |
finds return a cursor | |
when a block is supplied | |
yields to the cursor and closes it | |
when an enslave option exists | |
sends the query to the slave pool | |
deletes the enslave option | |
when an enslave option does not exist | |
sends the query to the master | |
#find_one | |
when an enslave option exists | |
sends the query to the slave pool | |
deletes the enslave option | |
when an enslave option does not exist | |
sends the query to the master | |
Mongoid::Collections::CyclicIterator | |
#initialize | |
defaults the counter to -1 | |
#next | |
when the iterator has just been created | |
returns the first element | |
when the iterator is in the middle | |
returns the next element given the index | |
when the iterator is on the last element | |
returns the first element | |
resets the counter | |
Mongoid::Collections::Master | |
Mongo::Collection operations | |
defines [] | |
defines db | |
defines count | |
defines distinct | |
defines find | |
defines find_one | |
defines group | |
defines index_information | |
defines map_reduce | |
defines mapreduce | |
defines stats | |
defines options | |
defines << | |
defines create_index | |
defines drop | |
defines drop_index | |
defines drop_indexes | |
defines insert | |
defines remove | |
defines rename | |
defines save | |
defines update | |
#[] | |
delegates to the collection | |
#db | |
delegates to the collection | |
#count | |
delegates to the collection | |
#distinct | |
delegates to the collection | |
#find | |
delegates to the collection | |
#find_one | |
delegates to the collection | |
#group | |
delegates to the collection | |
#index_information | |
delegates to the collection | |
#map_reduce | |
delegates to the collection | |
#mapreduce | |
delegates to the collection | |
#stats | |
delegates to the collection | |
#options | |
delegates to the collection | |
#<< | |
delegates to the collection | |
#create_index | |
delegates to the collection | |
#drop | |
delegates to the collection | |
#drop_index | |
delegates to the collection | |
#drop_indexes | |
delegates to the collection | |
#insert | |
delegates to the collection | |
#remove | |
delegates to the collection | |
#rename | |
delegates to the collection | |
#save | |
delegates to the collection | |
#update | |
delegates to the collection | |
Mongoid::Collections::Master | |
#empty? | |
when the slaves exist | |
returns false | |
when the slaves do not exist | |
returns true | |
when the slaves are nil | |
returns true | |
Mongo::Collection operations | |
defines [] | |
defines db | |
defines count | |
defines distinct | |
defines find | |
defines find_one | |
defines group | |
defines index_information | |
defines map_reduce | |
defines mapreduce | |
defines stats | |
defines options | |
#[] | |
delegates to the collection | |
#db | |
delegates to the collection | |
#count | |
delegates to the collection | |
#distinct | |
delegates to the collection | |
#find | |
delegates to the collection | |
#find_one | |
delegates to the collection | |
#group | |
delegates to the collection | |
#index_information | |
delegates to the collection | |
#map_reduce | |
delegates to the collection | |
#mapreduce | |
delegates to the collection | |
#stats | |
delegates to the collection | |
#options | |
delegates to the collection | |
Mongoid::Collections | |
.collection | |
sets the collection name to the class pluralized | |
when the document is embedded | |
when there is no cyclic relation | |
raises an error | |
when a cyclic relation exists | |
returns the collection | |
.collection_name= | |
on a parent class | |
sets the collection name on the document class | |
on a subclass | |
sets the collection name for the entire hierarchy | |
.index_information | |
returns index information from the collection | |
.logger= | |
sets the logger on the connection | |
.store_in | |
on a parent class | |
sets the collection name and collection for the document | |
on a subclass | |
changes the collection name for the entire hierarchy | |
Mongoid::Contexts::Enumerable::Sort | |
#initialize | |
sets the value | |
sets the sort order | |
#ascending? | |
when direction is :asc | |
should be true | |
when direction is :desc | |
should be false | |
#compare | |
when a is nil | |
and b is nil | |
should == 0 | |
and b is not nil | |
should == 1 | |
when a is not nil | |
and b is nil | |
should == -1 | |
and b is not nil | |
should use default comparison | |
<=> | |
when direction is ascending | |
returns the results of compare | |
when direction is descending | |
returns the inverse of compare | |
Mongoid::Contexts::Enumerable | |
#aggregate | |
groups by the fields provided in the options | |
stores the counts in proper groups | |
#avg | |
returns the avg value for the supplied field | |
#count | |
returns the size of the enumerable | |
#distinct | |
when the criteria is limited | |
returns an array of distinct values for the field | |
when the criteria is not limited | |
returns an array of distinct values for the field | |
#execute | |
calls sort on the filtered collection | |
when the selector is present | |
returns the matching documents from the array | |
when selector is empty | |
returns all the documents | |
when skip and limit are in the options | |
properly narrows down the matching results | |
when limit is set without skip in the options | |
properly narrows down the matching results | |
when skip is set without limit in the options | |
properly skips the specified records | |
#first | |
when a selector is present | |
returns the first that matches the selector | |
#group | |
groups by the fields provided in the options | |
stores the documents in proper groups | |
.initialize | |
sets the selector | |
sets the options | |
sets the documents | |
#iterate | |
executes the criteria | |
#last | |
when the selector is present | |
returns the last matching in the enumerable | |
#max | |
returns the max value for the supplied field | |
#min | |
returns the min value for the supplied field | |
#one | |
when the selector is present | |
returns the first matching in the enumerable | |
#page | |
when the page option exists | |
returns the page option | |
when the page option does not exist | |
returns 1 | |
#paginate | |
executes and paginates the results | |
#per_page | |
when a limit option exists | |
returns 20 | |
when a limit option does not exist | |
returns the limit | |
#sort | |
with no sort options | |
returns the documents as is | |
with sort options | |
sorts by the key | |
#sum | |
returns the sum of all the field values | |
#id_criteria | |
with a single argument | |
when the document is found | |
returns a matching document | |
when the document is not found | |
raises an error | |
multiple arguments | |
when an array of ids | |
when documents are found | |
returns matching documents | |
when documents are not found | |
raises an error | |
when an array of object ids | |
when documents are found | |
returns matching documents | |
when documents are not found | |
raises an error | |
Mongoid::Contexts::Mongo | |
#aggregate | |
when klass not provided | |
calls group on the collection with the aggregate js | |
#avg | |
calls group on the collection with the aggregate js | |
blank? | |
when a document exists | |
returns false | |
when a document does not exist | |
returns true | |
#count | |
when criteria has not been executed | |
returns a count from the cursor | |
when criteria has been executed | |
returns the count from the cursor without creating the documents | |
#distinct | |
returns delegates to distinct on the collection | |
#execute | |
when not paginating | |
calls find on the collection | |
when paginating | |
returns the cursor | |
should find the count from the cursor | |
when field options are supplied | |
when _type not in the field list | |
adds _type to the fields | |
#group | |
when klass provided | |
calls group on the collection with the aggregate js | |
.initialize | |
when hereditary | |
set the selector to query across the _type when it is hereditary | |
when not hereditary | |
does not add the type to the selector | |
#iterate | |
when not caching | |
executes the criteria | |
when caching | |
when executing once | |
executes the criteria | |
when executing twice | |
executes only once and it caches the result | |
when there is no block | |
executes the context | |
#last | |
when documents exist | |
calls find on the collection with the selector and sort options reversed | |
when no documents exist | |
returns nil | |
when no sorting options provided | |
defaults to sort by id | |
#max | |
calls group on the collection with the aggregate js | |
#min | |
calls group on the collection with the aggregate js | |
#one | |
when documents exist | |
calls find on the collection with the selector and options | |
when no documents exist | |
returns nil | |
#page | |
when the page option exists | |
returns the page option | |
when the page option does not exist | |
returns 1 | |
#paginate | |
executes and paginates the results | |
#paginate use last passed arguments | |
uses last passed per_page and page value | |
#shift | |
returns the first document | |
updates the criteria with the new skip value | |
#sum | |
when klass not provided | |
calls group on the collection with the aggregate js | |
#id_criteria | |
with a single argument | |
when the document is found | |
returns a matching document | |
when the document is not found | |
raises an error | |
multiple arguments | |
when an array of ids | |
when documents are found | |
returns matching documents | |
when documents are not found | |
raises an error | |
when an array of object ids | |
when documents are found | |
returns matching documents | |
when documents are not found | |
raises an error | |
Mongoid::Contexts | |
.context_for | |
when criteria is for a top-level document | |
creates a Mongo context | |
when criteria is for an embedded document | |
creates an Enumerable context | |
Mongoid::Copyable | |
#clone | |
when versions exist | |
returns a new document | |
has an id | |
has a different id from the original | |
does not clone the versions | |
unmemoizes the relations | |
returns a new instance | |
dups @accessed | |
dups @attributes | |
dups @metadata | |
dups @modifications | |
dups @previous_modifications | |
#dup | |
when versions exist | |
returns a new document | |
has an id | |
has a different id from the original | |
does not clone the versions | |
unmemoizes the relations | |
returns a new instance | |
dups @accessed | |
dups @attributes | |
dups @metadata | |
dups @modifications | |
dups @previous_modifications | |
Mongoid::Criteria | |
=== | |
when the other object is a Criteria | |
returns true | |
when the other object is not compatible | |
returns false | |
#+ | |
when the criteria has not been executed | |
executes the criteria and concats the results | |
when the other is a criteria | |
concats the results | |
#- | |
when the criteria has not been executed | |
executes the criteria and returns the difference | |
#[] | |
when the criteria has not been executed | |
executes the criteria and returns the element at the index | |
when methods delegate to the context | |
#aggregate | |
delegates to the context | |
#avg | |
delegates to the context | |
#blank? | |
when the context is blank | |
returns true | |
when the context is not blank | |
returns false | |
#distinct | |
delegates to the context | |
#count | |
delegates to the context | |
#exists? | |
when there are documents in the db | |
call the count context and return true if there are element | |
when there are no documents in the db | |
call the count context and return false if there are no element | |
#first | |
delegates to the context | |
#group | |
delegates to the context | |
#last | |
delegates to the context | |
#max | |
delegates to the context | |
#min | |
delegates to the context | |
#one | |
delegates to the context | |
#page | |
delegates to the context | |
#paginate | |
delegates to the context | |
#per_page | |
delegates to the context | |
#sum | |
delegates to the context | |
#clone | |
copies the selector | |
copies the options | |
copies the embedded flag | |
references the class | |
references the documents | |
#context | |
when the context has been set | |
returns the memoized context | |
when the context has not been set | |
creates a new context | |
when the class is embedded | |
returns an enumerable context | |
when the class is not embedded | |
returns a mongo context | |
#entries | |
filtering | |
filters out empty page params | |
filters out empty per page params | |
when type is :all | |
does not add the count instance variable | |
when type is not :first | |
calls find on the collection with the selector and options | |
#each | |
when the criteria has not been executed | |
executes the criteria | |
when the criteria has been executed | |
calls each on the existing results | |
when no block is passed | |
returns self | |
when caching | |
caches the results of the cursor iteration | |
#initialize | |
sets the selector to an empty hash | |
sets the options to an empty hash | |
sets the documents to an empty array | |
sets the klass to the given class | |
#merge | |
with another criteria | |
when the other has a selector and options | |
merges the selector | |
merges the options | |
when the other has no selector or options | |
merges the selector | |
merges the options | |
when the other has a document collection | |
merges the documents collection in | |
#method_missing | |
merges the criteria with the next one | |
chaining more than one scope | |
returns the final merged criteria | |
always returns a new criteria | |
when returning a non-criteria object | |
does not attempt to merge | |
when expecting behaviour of an array | |
#[] | |
collects the criteria and calls [] | |
#rand | |
collects the criteria and call rand | |
#scoped | |
when the options contain sort criteria | |
changes sort to order_by | |
.translate | |
with a single argument | |
when the arg is a string | |
delegates to #id_criteria | |
when the arg is an object id | |
delegates to #id_criteria | |
multiple arguments | |
when an array of ids | |
delegates to #id_criteria | |
when Person, :conditions => {} | |
returns a criteria with a selector from the conditions | |
returns a criteria with klass Person | |
when Person, :conditions => {:id => id} | |
returns a criteria with a selector from the conditions | |
returns a criteria with klass Person | |
when :all, :conditions => {} | |
returns a criteria with a selector from the conditions | |
returns a criteria with klass Person | |
when :last, :conditions => {} | |
returns a criteria with a selector from the conditions | |
returns a criteria with klass Person | |
when options are provided | |
sets the selector | |
sets the options | |
#fuse | |
when providing a selector | |
adds the selector | |
when providing a selector and options | |
adds the selector | |
adds the options | |
when chaining criteria after an initial execute | |
should not carry scope to cloned criteria | |
Mongoid::Criterion::Complex | |
#initialize | |
sets the key | |
sets the operator | |
when comparing equivalent objects | |
is identifiable as equal | |
hashes to the same value | |
when comparing different objects | |
is identifiable as different | |
hashes to a different value | |
Mongoid::Criterion::Creational | |
#create | |
when provided a valid selector | |
calls create on the class with the attributes | |
when provided invalid selectors | |
ignores the attributes | |
Mongoid::Criterion::Exclusion | |
#excludes | |
adds the $ne query to the selector | |
returns a copy | |
when passing an id | |
when setting the field as id | |
updates the selector | |
when setting the field as _id | |
updates the selector | |
when existing ne criteria exists | |
appends to the selector | |
#not_in | |
adds the exclusion to the selector | |
returns a copy | |
when existing nin criteria exists | |
appends to the nin selector | |
#only | |
when args are provided | |
adds the options for limiting by fields | |
returns a copy | |
when no args provided | |
does not add the field option | |
Mongoid::Criterion::Inclusion | |
#all | |
adds the $all query to the selector | |
returns a copy | |
when all criteria exists | |
appends to the existing criteria | |
#and | |
returns a copy | |
when provided a hash | |
adds the clause to the selector | |
when provided a string | |
adds the $where clause to the selector | |
#any_in | |
aliases to #in | |
#any_of | |
when provided a hash | |
on different fields | |
adds the $or criteria to the selector | |
on the same fields | |
adds the $or criteria to the selector | |
when supplying an array | |
adds the $or criteria to the selector | |
#in | |
adds the $in clause to the selector | |
returns a copy | |
when existing in criteria exists | |
appends to the existing criteria | |
#near | |
adds the $near modifier to the selector | |
#where | |
returns a copy | |
when provided a hash | |
with simple hash keys | |
adds the clause to the selector | |
when field defined as an array | |
allows a single value to be passed | |
with complex criterion | |
#all | |
returns a selector matching an all clause | |
#exists | |
returns a selector matching an exists clause | |
#gt | |
returns a selector matching a gt clause | |
#gte | |
returns a selector matching a gte clause | |
#in | |
returns a selector matching an in clause | |
#lt | |
returns a selector matching a lt clause | |
#lte | |
returns a selector matching a lte clause | |
#ne | |
returns a selector matching a ne clause | |
#near | |
returns a selector matching a ne clause | |
#nin | |
returns a selector matching a nin clause | |
#size | |
returns a selector matching a size clause | |
#near | |
returns a selector matching a ne clause | |
when provided a string | |
adds the $where clause to the selector | |
Mongoid::Criterion::Optional | |
#ascending | |
when providing a field | |
adds the ascending sort criteria | |
when providing nothing | |
does not modify the sort criteria | |
#asc | |
when providing a field | |
adds the ascending sort criteria | |
when providing nothing | |
does not modify the sort criteria | |
#cache | |
sets the cache option on the criteria | |
returns a copy | |
#cached? | |
when the criteria has a cache option | |
returns true | |
when the criteria has no cache option | |
returns false | |
when chaining sort criteria | |
does not overwrite any previous criteria | |
#descending | |
when providing a field | |
adds the descending sort criteria | |
when providing nothing | |
does not modify the sort criteria | |
#desc | |
when providing a field | |
adds the descending sort criteria | |
when providing nothing | |
does not modify the sort criteria | |
#enslave | |
sets the enslaved option on the criteria | |
returns a copy | |
#extras | |
returns a copy | |
filtering | |
when page is provided | |
sets the limit and skip options | |
when per_page is provided | |
sets the limit and skip options | |
when page and per_page both provided | |
sets the limit and skip options | |
when extras are provided | |
adds the extras to the options | |
#id | |
with not using object ids | |
when passing a single id | |
when the id is a string | |
adds the _id query to the selector | |
returns a copy | |
when the id is an object id | |
adds the _id query to the selector | |
returns a copy | |
when passing in an array of ids | |
adds the _id query to the selector | |
when passing in an array with only one id | |
adds the _id query to the selector | |
when using object ids | |
when passing a single id | |
when the id is a string | |
adds the _id query to the selector convert like BSON::ObjectId | |
returns a copy | |
when the id is an object id | |
adds the _id query to the selector without cast | |
returns a copy | |
when passing in an array of ids | |
adds the _id query to the selector with all ids like BSON::ObjectId | |
#limit | |
returns a copy | |
when value provided | |
adds the limit to the options | |
when value not provided | |
defaults to 20 | |
#offset | |
when the per_page option exists | |
returns the per_page option | |
when the skip option exists | |
returns the skip option | |
when an argument is provided | |
delegates to skip | |
when no option exists | |
when page option exists | |
returns the proper skip number | |
sets the proper skip option | |
when page option does not exist | |
returns nil | |
#order_by | |
returns a copy | |
when field names and direction specified | |
adds the sort to the options | |
when providing a hash of options | |
adds the sort to the options | |
when providing multiple symbols | |
adds the sort to the options | |
#page | |
when the page option exists | |
returns the page option | |
when the page option does not exist | |
returns 1 | |
#skip | |
returns a copy | |
when value provided | |
adds the skip value to the options | |
when value not provided | |
defaults to zero | |
#type | |
when the type is a string | |
adds the _type query to the selector | |
returns a copy | |
when the type is an Array of type | |
adds the _type query to the selector | |
returns a copy | |
Mongoid::Criterion::Selector | |
#initialize | |
should store the class | |
[]= | |
should store the values provided | |
should typecast values when possible | |
should typecast complex conditions | |
update | |
should typecast values when possible | |
merge! | |
should typecast values when possible | |
#try_to_typecast | |
when the key is not a declared field | |
returns the value | |
when the key is a declared field | |
returns the typecast value | |
#typecast_value_for | |
when the value is simple | |
should delegate to the field to typecast | |
when the field is an array | |
allows the simple value to be set | |
when the value is a regex | |
should return the regex unmodified | |
when the value is an array | |
and the field type is array | |
should let the field typecast the value | |
and the field type is not array | |
should typecast each value | |
when the value is a hash | |
and the field type is not hash | |
should not modify the original value | |
when the hash is an $exists query | |
should not typecast the hash | |
typecasts the value | |
when the hash is a $size query | |
should not typecast the hash | |
typecasts the value | |
and the field type is a hash | |
should let the field typecast the value | |
Mongoid::Cursor | |
#close | |
delegates to the proxy | |
#closed? | |
delegates to the proxy | |
#count | |
delegates to the proxy | |
#explain | |
delegates to the proxy | |
#fields | |
delegates to the proxy | |
#full_collection_name | |
delegates to the proxy | |
#hint | |
delegates to the proxy | |
#limit | |
delegates to the proxy | |
#order | |
delegates to the proxy | |
#query_options_hash | |
delegates to the proxy | |
#query_opts | |
delegates to the proxy | |
#selector | |
delegates to the proxy | |
#skip | |
delegates to the proxy | |
#snapshot | |
delegates to the proxy | |
#sort | |
delegates to the proxy | |
#collection | |
returns the mongoid collection | |
#each | |
yields to the next document | |
#next_document | |
returns the next document from the proxied cursor | |
#to_a | |
converts the proxy cursor to an array of documents | |
Mongoid::DefaultScope | |
.default_scope | |
options | |
should == {:sort=>[[:name, :asc]]} | |
combined with a named scope | |
options | |
should == {:sort=>[[:name, :asc]]} | |
selector | |
should == {:status=>"active"} | |
Mongoid::Dirty | |
#attribute_change | |
when the attribute has changed | |
returns an array of the old value and new value | |
allows access via (attribute)_change | |
when the attribute changes multiple times | |
returns an array of the original value and new value | |
allows access via (attribute)_change | |
when the attribute is modified in place | |
when the attribute is an array | |
returns an array of the original value and new value | |
allows access via (attribute)_change | |
when the attribute changes multiple times | |
returns an array of the original value and new value | |
when the attribute is a hash | |
returns an array of the original value and new value | |
allows access via (attribute)_change | |
when the attribute changes multiple times | |
returns an array of the original value and new value | |
when the attribute has not changed | |
returns an empty array | |
when the attribute has been set with the same value | |
returns an empty array | |
when the attribute is removed | |
returns an empty array | |
#attribute_changed? | |
when the attribute has changed | |
returns true | |
allows access via (attribute)_changed? | |
when the attribute has not changed | |
returns false | |
#attribute_was | |
when the attribute has changed | |
returns the old value | |
allows access via (attribute)_was | |
when the attribute has not changed | |
returns the original value | |
#changed | |
when the document has changed | |
returns an array of changed field names | |
when the document has not changed | |
returns an empty array | |
#changed? | |
when the document has changed | |
returns true | |
when the document has not changed | |
returns false | |
#changes | |
when the document has changed | |
returns a hash of changes | |
when the document has not changed | |
returns an empty hash | |
#setters | |
when the document has changed | |
when the document is a root document | |
returns a hash of field names and new values | |
when the document is embedded | |
returns a hash of field names and new values | |
when the document is embedded multiple levels | |
returns the proper hash with locations | |
when the document has not changed | |
returns an empty hash | |
#previous_changes | |
when the document has been saved | |
returns the changes before the save | |
when the document has not been saved | |
returns an empty hash | |
#reset_attribute! | |
when the attribute has changed | |
resets the value to the original | |
allows access via reset_(attribute)! | |
removes the field from the changes | |
when the attribute has not changed | |
does nothing | |
#reset_modifications | |
when the attribute has changed | |
does not reset the value | |
removes the note of the change | |
Mongoid::Document | |
does not respond to _destroy | |
#== | |
when comparable is not a document | |
returns false | |
when comparable is a document | |
when it has the same id | |
returns true | |
when it has a different id | |
when the instances are the same | |
returns true | |
when the instances are different | |
returns false | |
.=== | |
when comparable is an instance of this document | |
returns true | |
when comparable is a relation of this document | |
returns true | |
when comparable is the same class | |
returns true | |
#=== | |
when comparable is the same type | |
returns true | |
#<=> | |
compares based on the document id | |
._types | |
when the document is subclassed | |
includes the root | |
includes the subclasses | |
when the document is not subclassed | |
returns the document | |
#attributes | |
returns the attributes with indifferent access | |
#eql? | |
when comparable is not a document | |
returns false | |
when comparable is a document | |
when it has the same id | |
returns true | |
when it has a different id | |
when the instances are the same | |
returns true | |
when the instances are different | |
returns false | |
#hash | |
returns the id hash | |
#identify | |
creates a new identity | |
#initialize | |
sets persisted to false | |
creates an id for the document | |
sets the attributes | |
when initialize callbacks are defined | |
runs the callbacks | |
when defaults are defined | |
sets the default values | |
when a block is provided | |
yields to the block | |
#.instantiate | |
when an id exists | |
sets the attributes | |
sets persisted to true | |
when attributes are nil | |
creates a new document | |
creates an id | |
#raw_attributes | |
returns the internal attributes | |
#reload | |
when the document has been persisted | |
reloads the attributes | |
reloads the relations | |
when the document is new | |
when raising a not found error | |
raises an error | |
when not raising a not found error | |
sets the attributes to empty | |
when a relation is set as nil | |
removes the instance variable | |
#remove_child | |
when child is an embeds one | |
removes the relation instance | |
when child is an embeds many | |
removes the document from the relation target | |
#to_a | |
returns the document in an array | |
#as_document | |
includes embeds one attributes | |
includes embeds many attributes | |
includes second level embeds many attributes | |
#to_key | |
when the document is new | |
returns nil | |
when the document is not new | |
returns the id in an array | |
#to_param | |
when the document is new | |
returns nil | |
when the document is not new | |
returns the id as a string | |
Mongoid::Errors | |
Mongoid::Errors::DocumentNotFound | |
attribute readers | |
exists for @identifiers | |
exists for @klass | |
#message | |
default | |
contains document not found | |
Mongoid::Errors::UnsavedDocument | |
#message | |
returns that create can not be called | |
Mongoid::Errors::InvalidOptions | |
#message | |
default | |
returns the class name | |
Mongoid::Errors::InvalidDatabase | |
#message | |
returns a message with the bad db object class | |
Mongoid::Errors::InvalidType | |
#message | |
returns a message with the bad type and supplied value | |
Mongoid::Errors::UnsupportedVersion | |
#message | |
returns a message with the bad version and good version | |
Mongoid::Errors::Validations | |
#message | |
default | |
contains the errors' full messages | |
#document | |
contains the a reference to the document | |
Mongoid::Errors::InvalidCollection | |
#message | |
default | |
contains class is not allowed | |
Mongoid::Errors::InvalidField | |
#message | |
default | |
contains class is not allowed | |
Mongoid::Errors::TooManyNestedAttributeRecords | |
#message | |
default | |
contains error message | |
Mongoid::Extensions::Array::Conversions | |
#get | |
when the value is not an array | |
raises an error | |
when the value is nil | |
returns nil | |
when the value is an array | |
returns the array | |
#set | |
when the value is not an array | |
raises an error | |
when the value is nil | |
returns nil | |
when the value is an array | |
returns the array | |
Mongoid::Extensions::Array::Parentization | |
#parentize | |
sets the parent on each element | |
Mongoid::Extensions::BigDecimal::Conversions | |
#get | |
converts the string to a big decimal | |
when nil | |
returns nil | |
#set | |
converts the big decimal to a string | |
when nil | |
returns nil | |
Mongoid::Extensions::Binary::Conversions | |
#get | |
returns self | |
#set | |
returns self | |
Mongoid::Extensions::Boolean::Conversions | |
.set | |
when 'true' | |
returns true | |
when 'false' | |
returns false | |
when 0 | |
returns false | |
when 1 | |
returns true | |
when nil | |
returns nil | |
.get | |
returns the boolean | |
Mongoid::Extensions::Date::Conversions | |
.set | |
when given nil | |
returns nil | |
when string is empty | |
returns nil | |
when given a string | |
converts to a utc time | |
returns the right day | |
returns a utc date from the string | |
when given a DateTime | |
returns a time | |
when given a Time | |
converts to a utc time | |
strips miliseconds | |
returns utc times the same day, but at midnight | |
returns the date for the time | |
when given an ActiveSupport::TimeWithZone | |
converts it to utc | |
when given a Date | |
converts to a utc time | |
when given an Array | |
converts to a utc time | |
.get | |
converts the time back to a date | |
when the time zone is not defined | |
when the local time is not observing daylight saving | |
returns the same day | |
when the local time is observing daylight saving | |
returns the same day | |
when the time zone is defined as UTC | |
returns the same day | |
when time is nil | |
returns nil | |
round trip - set then get | |
when the time zone is not defined | |
when the local time is not observing daylight saving | |
does not change the day | |
when the local time is observing daylight saving | |
does not change the day | |
Mongoid::Extensions::DateTime::Conversions | |
.get | |
converts to a datetime | |
FalseClass | |
#is_a? | |
when provided a Boolean | |
returns true | |
when provided a FalseClass | |
returns true | |
when provided a TrueClass | |
returns false | |
when provided an invalid class | |
returns false | |
Mongoid::Extensions::Float::Conversions | |
#set | |
when the value is a number | |
converts the number to a float | |
when the value is not a number | |
when the value is non numerical | |
returns the string | |
when the string is numerical | |
returns the float value for the string | |
when the string is empty | |
returns 0.0 | |
when the string is nil | |
returns 0.0 | |
#get | |
returns the float | |
Mongoid::Extensions::Hash::Conversions | |
.get | |
returns the hash | |
.set | |
returns the hash | |
Mongoid::Extensions::Hash::CriteriaHelpers | |
#expand_complex_criteria | |
expands complex criteria to form a valid `where` hash | |
merges multiple complex criteria to form a valid `where` hash | |
Mongoid::Extensions::Hash::Scoping | |
#scoped | |
returns self | |
Mongoid::Extensions::Integer::Conversions | |
#set | |
when the value is a number | |
converts the number to an integer | |
when the string is not a number | |
when the string is non numerical | |
returns the string | |
when the string is numerical | |
returns the integer value for the string | |
when the string is empty | |
returns an empty string | |
when the string is nil | |
returns nil | |
#get | |
returns the integer | |
Mongoid::Extensions::Nil::Collectionization | |
#collectionize | |
returns '' | |
Mongoid::Extensions::Object::Conversions | |
#get | |
when the value is a mongoid document | |
instantiates a new class from the attributes | |
when the value is a primitive type | |
it returns the value | |
when the value is nil | |
returns nil | |
#set | |
when object has attributes | |
converts the object to a hash | |
Mongoid::Extensions::Object::Yoda | |
#do_or_do_not | |
when the object is nil | |
returns nil | |
when the object is not nil | |
when the object responds to the method | |
returns the result of the method | |
when the object does not respond to the method | |
returns the result of the method | |
Mongoid::Extensions::ObjectId::Conversions | |
.cast! | |
when not using object ids | |
returns args | |
when using object ids | |
transforms String args to BSON::ObjectIds | |
transforms all Strings inside an Array | |
when casting is false | |
doesnt change the argument types | |
.get | |
returns self | |
.set | |
with a blank string | |
returns nil | |
with a populated string | |
returns ObjectID | |
with an ObjectID | |
returns self | |
Mongoid::Extensions::Proc::Scoping | |
#scoped | |
when the proc accessed a hash | |
calls the hash with the args | |
when the proc calls a criteria | |
returns the criteria scoped | |
Mongoid::Extensions::Set::Conversions | |
#get | |
returns the set if Array | |
#set | |
returns an array | |
returns an array even if the value is a set | |
Mongoid::Extensions::String::Conversions | |
.get | |
returns the string | |
.set | |
when the value is not nil | |
returns the object to_s | |
when the value is nil | |
returns nil | |
#to_a | |
returns an array with the string in it | |
Mongoid::Extensions::String::Inflections | |
#collectionize | |
when class is namepaced | |
returns an underscored tableized name | |
when class is not namespaced | |
returns an underscored tableized name | |
#identify | |
when parameterizing composite keys | |
converts the string to all lowercase and dashed | |
when not parameterizing keys | |
does nothing to the keys | |
#labelize | |
returns the underscored name humanized | |
#singular? | |
when singular | |
returns true | |
when string is added to inflections | |
returns true | |
when plural | |
returns false | |
when string is added to inflections | |
returns false | |
plural? | |
when singular | |
returns false | |
when string is added to inflections | |
returns false | |
when plural | |
returns true | |
when string is added to inflections | |
returns true | |
invert | |
when asc | |
returns desc | |
when ascending | |
returns descending | |
when desc | |
returns asc | |
when descending | |
returns ascending | |
#reader | |
when string is a reader | |
returns self | |
when string is a writer | |
returns the reader | |
#writer? | |
when string is a reader | |
returns false | |
when string is a writer | |
returns true | |
Mongoid::Extensions::Symbol::Conversions | |
.set | |
when given nil | |
returns nil | |
when string is empty | |
returns nil | |
when given a symbol | |
returns the symbol | |
when given a string | |
returns the symbol | |
.get | |
returns a symbol | |
returns the same symbol | |
Mongoid::Extensions::Symbol::Inflections | |
#singular? | |
when singular | |
returns true | |
when plural | |
returns false | |
plural? | |
when singular | |
returns false | |
when plural | |
returns true | |
invert | |
when :asc | |
returns :desc | |
when :ascending | |
returns :descending | |
when :desc | |
returns :asc | |
when :descending | |
returns :ascending | |
#gt | |
returns :"foo $gt" | |
#near | |
returns :"foo $near" | |
#within | |
returns :foo $within | |
Mongoid::Extensions::TimeConversions | |
.set | |
when given nil | |
returns nil | |
when string is empty | |
returns nil | |
when given a string | |
converts to a utc time | |
uses Time.parse - note that this returns the wrong day due sometimes since it ignores the time zone | |
returns a local date from the string due to a limitation in Time.parse | |
when using the ActiveSupport time zone | |
when the local time is not observing daylight saving | |
returns the local time | |
when the local time is observing daylight saving | |
returns the local time | |
when given a DateTime | |
returns a time | |
when using the ActiveSupport time zone | |
assumes the given time is local | |
when given a Time | |
converts to a utc time | |
strips miliseconds | |
returns utc times unchanged | |
returns the time as utc | |
when given an ActiveSupport::TimeWithZone | |
converts it to utc | |
when given a Date | |
converts to a utc time | |
when using the ActiveSupport time zone | |
assumes the given time is local | |
when given an array | |
returns a time | |
when using the ActiveSupport time zone | |
assumes the given time is local | |
.get | |
when the time zone is not defined | |
when the local time is not observing daylight saving | |
returns the local time | |
when the local time is observing daylight saving | |
returns the local time | |
when we have a time close to midnight | |
change it back to the equivalent local time | |
when using the ActiveSupport time zone | |
returns an ActiveSupport::TimeWithZone | |
when the local time is not observing daylight saving | |
returns the local time | |
when the local time is observing daylight saving | |
returns the local time | |
when we have a time close to midnight | |
change it back to the equivalent local time | |
when the time zone is defined as UTC | |
returns utc | |
when using the ActiveSupport time zone | |
returns utc | |
returns an ActiveSupport::TimeWithZone | |
when time is nil | |
returns nil | |
round trip - set then get | |
when the time zone is not defined | |
when the local time is not observing daylight saving | |
returns the local time | |
when the local time is observing daylight saving | |
returns the local time | |
when we have a time close to midnight | |
does not change a local time | |
when the time zone is defined as UTC | |
when the local time is not observing daylight saving | |
returns UTC | |
when the local time is observing daylight saving | |
returns UTC | |
when we have a time close to midnight | |
changes the day since UTC is behind Stockholm | |
TrueClass | |
#is_a? | |
when provided a Boolean | |
returns true | |
when provided a FalseClass | |
returns false | |
when provided a TrueClass | |
returns true | |
when provided an invalid class | |
returns false | |
Mongoid::Extras | |
.cache | |
sets the cached boolean on the class | |
.cached? | |
when the class is cached | |
returns true | |
when the class is not cached | |
returns false | |
#cached? | |
returns the class cached? value | |
.enslave | |
sets the enslaved boolean on the class | |
.enslaved? | |
when the class is enslaved | |
returns true | |
when the class is not enslaved | |
returns false | |
#enslaved? | |
returns the class enslaved? value | |
Mongoid::Factory | |
.build | |
when the _type attribute is present | |
instantiates based on the type | |
when _type is not preset | |
instantiates based on the type | |
Mongoid::Field | |
#default | |
returns the default option | |
returns the typed value | |
when the field is an array | |
when the array is user defined | |
dups the array | |
when the array is object ids | |
when using object ids | |
performs conversion on the ids if strings | |
when not using object ids | |
does not convert | |
when the field is a hash | |
dups the hash | |
#initialize | |
when the field name is invalid | |
raises an error | |
when the default value does not match the type | |
raises an error | |
#name | |
returns the name | |
#type | |
defaults to Object | |
#label | |
defaults to nil | |
allows a label to be set an retrieved | |
#set | |
nil is provided | |
returns the default value | |
value is provided | |
sets the value | |
#get | |
returns the value | |
#options | |
stores the arbitrary options | |
Mongoid::Fields | |
.defaults | |
returns a hash of all the default values | |
#defaults | |
with defaults specified as a non-primitive | |
should not return the same object when calling defaults with a default hash | |
should not return the same object when calling defaults with a default array | |
on parent classes | |
does not return subclass defaults | |
on subclasses | |
has the parent and child defaults | |
.field | |
with no options | |
adds a reader for the fields defined | |
adds a writer for the fields defined | |
adds an reader method with a question mark | |
adds field methods in a module to allow overriding and preserve inheritance | |
when the type is an object | |
returns the given value | |
when type is a mongoid document | |
allows proper access to the object | |
adds an reader method with a question mark | |
when type is a boolean | |
adds an accessor method with a question mark | |
when as is specified | |
uses the alias to write the attribute | |
uses the alias to read the attribute | |
uses the alias for the query method | |
#fields | |
on parent classes | |
does not return subclass fields | |
on subclasses | |
has the parent and child fields | |
Mongoid::Finders | |
.all | |
when a selector is provided | |
finds from the collection and instantiate objects for each returned | |
when a selector is not provided | |
finds from the collection and instantiate objects for each returned | |
.all_in | |
returns a new criteria with select conditions added | |
.any_in | |
returns a new criteria with select conditions added | |
.count | |
with options provided | |
delegates to the criteria api | |
when no options provided | |
adds in the default parameters | |
.exists? | |
when options are provided | |
when count is greater than zero | |
returns true | |
when the count is zero | |
returns false | |
when no options are provided | |
when count is greater than zero | |
returns true | |
when the count is zero | |
returns false | |
.excludes | |
returns a new criteria with select conditions added | |
.find | |
when an id is provided | |
when a document is found | |
returns the document | |
when no document is found | |
raises an error | |
when it is called with a nil value | |
raises an InvalidOptions error | |
when an array of ids is passed in | |
when a document is found | |
returns the document | |
when no document is found | |
raises an error | |
when finding first | |
delegates to criteria | |
when finding all | |
delegates to find_all | |
when sorting | |
adds the sort parameters for the collection call | |
.find_or_create_by | |
when the document is found | |
returns the document | |
when the document is not found | |
creates a new document | |
sets the attributes | |
.find_or_initialize_by | |
when the document is found | |
returns the document | |
when the document is not found | |
creates a new document | |
sets the attributes | |
.first | |
when a selector is provided | |
returns the first document in the collection | |
when a selector is not provided | |
finds the first document from the collection and instantiates it | |
.last | |
finds the last document by the id | |
.max | |
returns the sum of a new criteria | |
.min | |
returns the sum of a new criteria | |
.not_in | |
returns a new criteria with select conditions added | |
.paginate | |
when pagination parameters are passed | |
delegates to will paginate with the results | |
when pagination parameters are not passed | |
delegates to will paginate with default values | |
.only | |
returns a new criteria with select conditions added | |
.sum | |
returns the sum of a new criteria | |
.where | |
returns a new criteria with select conditions added | |
.near | |
returns a new criteria with select conditions added | |
Mongoid::Hierarchy | |
#_children | |
with one level of embedding | |
includes embeds_one documents | |
includes embeds_many documents | |
with multiple levels of embedding | |
includes embeds_one documents | |
includes embeds_many documents | |
includes embedded documents multiple levels deep | |
.hereditary? | |
when the document is a subclass | |
returns true | |
when the document is not a subclass | |
returns false | |
#hereditary? | |
when the document is a subclass | |
returns true | |
when the document is not a subclass | |
returns false | |
#parentize | |
sets the parent document | |
#_root | |
when the document is not the root | |
returns the root | |
when the document is the root | |
returns self | |
Mongoid::Identity | |
#create | |
when the class is polymorphic | |
sets the document type to the class name | |
when class is inherited | |
sets the document _type to the class name | |
when class is a subclass | |
sets the document _type to the class name | |
when not using inheritance | |
does not set the type | |
when the document has a primary key | |
sets the id to the composite key | |
when the document has no primary key | |
when the document has no id | |
when using object ids | |
sets the id to a mongo object id | |
when not using object ids | |
sets the id to a mongo object id string | |
when the document has an id | |
returns the existing id | |
Mongoid::Indexes | |
.included | |
adds an index_options accessor | |
defaults index_options to empty hash | |
.create_indexes | |
creates the indexes | |
.add_indexes | |
when indexes have not been added | |
adds the _type index | |
when indexes have been added | |
ignores the request | |
.index | |
when unique | |
creates a unique index on the collection | |
when not unique | |
creates an index on the collection | |
Mongoid::Inspection | |
#inspect | |
with allow_dynamic_fields = false | |
returns a pretty string of class name and attributes | |
with allow_dynamic_fields = true | |
returns a pretty string of class name, attributes, and dynamic attributes | |
Mongoid::Javascript | |
.aggregate | |
returns the aggregate function | |
.group | |
returns the group function | |
.max | |
returns the max function | |
.min | |
returns the min function | |
.sum | |
returns the sum function | |
Mongoid::JSON | |
.include_root_in_json | |
when config set to true | |
returns true | |
when config set to false | |
returns false | |
Mongoid::Keys | |
.identity | |
when provided a type | |
sets the type of the id | |
.key | |
when key is single field | |
adds the callback for primary key generation | |
changes the _id_type to a string | |
when key is composite | |
combines all fields | |
when key is on a subclass | |
sets the key for the entire hierarchy | |
#using_object_ids? | |
when id type is an object id | |
returns true | |
when id type is not an object id | |
returns false | |
locales | |
no parsing errors for locale lib/config/locales/bg.yml | |
no parsing errors for locale lib/config/locales/de.yml | |
no parsing errors for locale lib/config/locales/en.yml | |
no parsing errors for locale lib/config/locales/es.yml | |
no parsing errors for locale lib/config/locales/fr.yml | |
no parsing errors for locale lib/config/locales/hu.yml | |
no parsing errors for locale lib/config/locales/it.yml | |
no parsing errors for locale lib/config/locales/kr.yml | |
no parsing errors for locale lib/config/locales/nl.yml | |
no parsing errors for locale lib/config/locales/pl.yml | |
no parsing errors for locale lib/config/locales/pt-br.yml | |
no parsing errors for locale lib/config/locales/pt.yml | |
no parsing errors for locale lib/config/locales/ro.yml | |
no parsing errors for locale lib/config/locales/sv.yml | |
no parsing errors for locale lib/config/locales/zh-CN.yml | |
Mongoid::Logger | |
.logger | |
returns Mongoid's configured logger | |
log_levels | |
with a logger set | |
info delegates to the configured logger | |
debug delegates to the configured logger | |
warn delegates to the configured logger | |
error delegates to the configured logger | |
fatal delegates to the configured logger | |
with a nil logger | |
info does nothing | |
debug does nothing | |
warn does nothing | |
error does nothing | |
fatal does nothing | |
Mongoid::Matchers::All | |
#matches? | |
when the values are equal | |
returns true | |
when the values are not equal | |
returns false | |
Mongoid::Matchers::Default | |
#matches? | |
when the values are equal | |
returns true | |
when the values are not equal | |
returns false | |
#matches? when comparing a String to an Array attribute | |
when the attribute contains the value | |
returns true | |
when the attribute does not contain the value | |
returns false | |
Mongoid::Matchers::Exists | |
#matches? | |
when checking for existence | |
when the value exists | |
returns true | |
when the value does not exist | |
returns false | |
when checking for nonexistence | |
when the value exists | |
returns false | |
when the value does not exist | |
returns true | |
Mongoid::Matchers::Gt | |
#matches? | |
when the value is larger | |
returns true | |
when the value is smaller | |
returns false | |
when the value is nil | |
returns false | |
Mongoid::Matchers::Gte | |
#matches? | |
when the value is larger | |
returns true | |
when the value is smaller | |
returns false | |
when the value is equal | |
returns true | |
when the value is nil | |
returns false | |
Mongoid::Matchers::In | |
#matches? | |
when the values includes the attribute | |
returns true | |
when the values dont include the atribute | |
returns false | |
Mongoid::Matchers::Lt | |
#matches? | |
when the value is larger | |
returns false | |
when the value is smaller | |
returns true | |
when the value is nil | |
returns false | |
Mongoid::Matchers::Lte | |
#matches? | |
when the value is larger | |
returns false | |
when the value is smaller | |
returns true | |
when the value is equal | |
returns true | |
when the value is nil | |
returns false | |
Mongoid::Matchers::Ne | |
#matches? | |
when the values are not equal | |
returns true | |
when the values are equal | |
returns false | |
Mongoid::Matchers::Nin | |
#matches? | |
when the values do not contain the attribute | |
returns true | |
when the values contain the attribute | |
returns false | |
Mongoid::Matchers::Size | |
#matches? | |
when the attribute is the same size | |
returns true | |
when the attribute is not the same size | |
returns false | |
Mongoid::Matchers | |
#matches? | |
when performing simple matching | |
when the attributes match | |
returns true | |
when the attributes dont match | |
returns false | |
when performing complex matching | |
with an $all selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with an $exists selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with a $gt selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with a $gte selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with an $in selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with a $lt selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with a $lte selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with an $ne selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with a $nin selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
with a $size selector | |
when the attributes match | |
returns true | |
when the attributes do not match | |
returns false | |
Mongoid::Modifiers::Inc | |
#persist | |
when safe mode provided | |
increments with the safe mode in the options | |
when safe mode not provided | |
increments with safe mode as globally defined | |
in conjunction with dirty attributes | |
does not mark the field as dirty | |
Mongoid::Modifiers | |
#inc | |
persists the $inc modifier | |
returns the new field value | |
Mongoid::MultiDatabase | |
.database | |
sets the database key on the class | |
Mongoid::MultiParameterAttributes | |
#process | |
creating a post | |
should set a multi-parameter Time attribute correctly | |
should not leave ugly attributes on the model | |
creating a person | |
with a valid DOB | |
should set a multi-parameter Date attribute correctly | |
with an invalid DOB | |
should raise an exception | |
with a blank DOB | |
should not raise an exception | |
should generate a nil date | |
with a partially blank DOB | |
should not raise an exception | |
should set empty date's parts to 1 | |
Mongoid::NamedScope | |
.named_scope | |
adds a class method for the scope | |
adds the scope to the scopes | |
when options are a hash | |
adds the selector to the scope | |
when options are a criteria | |
adds the selector to the scope | |
when options are a proc | |
when the proc delegates to a hash | |
adds the selector to the scope | |
when the proc delegates to a criteria | |
adds the selector to the scope | |
when a block is supplied | |
adds a class method for the scope | |
adds the scope to the scopes | |
.scope | |
aliases to named_scope | |
chained scopes | |
when chaining two named scopes | |
merges the criteria | |
when chaining named scoped with criteria class methods | |
merges the criteria | |
Mongoid::NestedAttributes | |
.accepts_nested_attributes_for | |
adds a method for handling the attributes | |
adds the method name to the nested attributes list | |
Mongoid::Paranoia | |
#delete! | |
removes the document from the database | |
sets destroyed to true | |
#destroyed? | |
when the document was marked as deleted | |
returns true | |
when the document was not marked as deleted | |
returns true | |
#_remove | |
sets the deleted_at flag in the database | |
sets the deleted flag | |
#_restore | |
removes the deleted_at flag from the database | |
removes the deleted flag | |
Mongoid::Paths | |
#._remover | |
when document is root | |
returns nil | |
when document is an embeds_one | |
returns $unset | |
when document is an embeds_many | |
returns $pull | |
#._inserter | |
when document is root | |
returns nil | |
when document is an embeds_one | |
returns $set | |
when document is an embeds_many | |
returns $push | |
#._path | |
when the document is a parent | |
returns an empty string | |
when the document is embedded | |
returns the inverse_of value of the association | |
when document embedded multiple levels | |
returns the JSON notation to the document | |
#._selector | |
when the document is a parent | |
returns an id._selector | |
when the document is embedded | |
returns the association with id._selector | |
when document embedded multiple levels | |
returns the JSON notation to the document with ids | |
#._position | |
when the document is a parent | |
returns an empty string | |
when the document is embedded | |
when the document is new | |
returns the._path without index | |
when the document is not new | |
returns the._path plus index | |
when document embedded multiple levels | |
when the document is new | |
returns the._path with parent indexes | |
when the document is not new | |
returns the._path plus index | |
#._pull | |
when the document is a parent | |
returns an empty string | |
when the document is embedded | |
when the document is not new | |
returns the._path without the index | |
and there are 10 or more documents | |
returns the._path without the index | |
when document embedded multiple levels | |
when the document is not new | |
returns the._path plus index | |
Mongoid::Persistence::Insert | |
#persist | |
when the embedded document is an embeds_one | |
when the parent is new | |
notifies its changes to parent and inserts the parent | |
when the parent is not new | |
performs an in place $set on the embedded document | |
sets new_record to false | |
when the embedded document is an embeds_many | |
when the parent is new | |
notifies its changes to the parent and inserts the parent | |
sets new_record to false | |
when the parent is not new | |
performs a $push on the embedded array | |
when we add the parent to the child | |
performs a $push on the embedded array | |
Mongoid::Persistence::Insert | |
#initialize | |
sets the document | |
sets the collection | |
defaults validation to true | |
sets the options | |
#persist | |
when the document is valid | |
inserts the new document | |
returns the document | |
sets new_record to false | |
when the document is not valid | |
returns the document | |
leaves the document as a new record | |
when not validating | |
inserts the document in the database | |
when the document is embedded | |
delegates to the embedded persister | |
Mongoid::Persistence::RemoveAll | |
#initialize | |
sets the collection | |
sets the options | |
sets the selector | |
#persist | |
when the document is a root document | |
remove_alls the document from the collection | |
returns the count of documents removed | |
Mongoid::Persistence::RemoveEmbedded | |
#persist | |
when the embedded document is an embeds_one | |
when the parent is new | |
notifies its changes to parent and removes the parent | |
when the parent is not new | |
performs an in place $set on the embedded document | |
when the embedded document is an embeds_many | |
when the parent is new | |
notifies its changes to the parent and removes the document | |
when the parent is not new | |
performs a $pull on the embedded array | |
when embedded multiple levels | |
performs a $pull on the embedded array | |
Mongoid::Persistence::Remove | |
#initialize | |
sets the document | |
sets the collection | |
defaults validation to true | |
sets the options | |
#persist | |
when the document is a root document | |
removes the document from the collection | |
when the document is embedded | |
delegates to the embedded persister | |
Mongoid::Persistence::Update | |
#initialize | |
sets the document | |
sets the collection | |
defaults validation to true | |
#persist | |
when the document is changed | |
when the document is a tree (PENDING: Not Yet Implemented) | |
when the document is valid | |
performs a $set for changed fields | |
moves the changed fields to previously changed | |
when the document is not valid | |
returns false | |
when not validating | |
updates the document in the database | |
when the document is embedded | |
performs a $set for the embedded changed fields | |
Mongoid::Persistence | |
.create | |
delegates to the insert persistence command | |
returns the new document | |
.create! | |
when validation passes | |
returns the new document | |
when validation fails | |
raises an error | |
.delete_all | |
when conditions provided | |
removes all documents from the collection for the conditions | |
returns the number of documents removed | |
when conditions not provided | |
removes all documents from the collection | |
returns the number of documents removed | |
.destroy_all | |
when conditions provided | |
destroys each found document | |
returns the number destroyed | |
when conditions not provided | |
destroys each found document | |
returns the number destroyed | |
#delete | |
delegates to the remove persistence command | |
#destroy | |
delegates to the remove persistence command | |
#insert | |
delegates to the insert persistence command | |
#remove | |
delegates to the remove persistence command | |
#save | |
when the document is new | |
delegates to the insert persistence command | |
returns a boolean | |
when the document is not new | |
delegates to the update persistence command | |
returns a boolean | |
#save! | |
when validation passes | |
returns true | |
when validation failes | |
raises an error | |
#update | |
delegates to the update persistence command | |
#update_attributes | |
writes attributes and performs an update | |
#update_attributes! | |
when validation passes | |
writes attributes and performs an update | |
when validation fails | |
raises an error | |
#upsert | |
when passing a hash as a validation parameter | |
delegates to the insert persistence command | |
when the document is new | |
when validation passes | |
delegates to the insert persistence command | |
returns a boolean | |
when validation fails | |
returns false | |
when the document is not new | |
delegates to the update persistence command | |
returns a boolean | |
A document loaded from rails | |
defines a _destroy method | |
#_destroy | |
always returns false | |
Mongoid::Relations::Accessors | |
Mongoid::Relations::Bindings::Embedded::In | |
#bind | |
when the child of an embeds one | |
when the document is bindable | |
parentizes the documents | |
sets the inverse relation | |
when the document is not bindable | |
does nothing | |
when the child of an embeds many | |
when the document is bindable | |
parentizes the documents | |
sets the inverse relation | |
when the document is not bindable | |
does nothing | |
#unbind | |
when the child of an embeds one | |
when the document is unbindable | |
removes the inverse relation | |
when the document is not unbindable | |
does nothing | |
when the child of an embeds many | |
when the document is unbindable | |
removes the inverse relation | |
when the document is not unbindable | |
does nothing | |
Mongoid::Relations::Bindings::Embedded::Many | |
#bind_all | |
when the documents are bindable | |
parentizes the documents | |
sets the inverse relation | |
when the documents are not bindable | |
does nothing | |
#bind_one | |
when the document is bindable | |
parentizes the document | |
sets the inverse relation | |
when the document is not bindable | |
does nothing | |
#unbind | |
when the documents are unbindable | |
removes the inverse relation | |
when the documents are not unbindable | |
does nothing | |
Mongoid::Relations::Bindings::Embedded::One | |
#bind | |
when the document is bindable | |
parentizes the documents | |
sets the inverse relation | |
when the document is not bindable | |
does nothing | |
#unbind | |
when the document is unbindable | |
removes the inverse relation | |
when the document is not unbindable | |
does nothing | |
Mongoid::Relations::Bindings::Referenced::In | |
Mongoid::Relations::Bindings::Referenced::One | |
Mongoid::Relations::Builders::Embedded::In | |
#build | |
when a document is provided | |
returns the document | |
when attributes are provided | |
returns a new document | |
sets the attributes on the document | |
Mongoid::Relations::Builders::Embedded::Many | |
#build | |
when passed an array of documents | |
returns an array of documents | |
when the array is empty | |
returns an empty array | |
when passed nil | |
returns an empty array | |
when no type is in the object | |
returns an array of documents | |
creates the correct type of documents | |
sets the object on the documents | |
when a type is in the object | |
returns an array of documents | |
creates the correct type of document | |
sets the object on the document | |
Mongoid::Relations::Builders::Embedded::One | |
#build | |
when provided nil | |
returns nil | |
when provided a document | |
returns the document | |
when no type is in the object | |
creates the correct type of document | |
sets the object on the document | |
when a type is in the object | |
creates the correct type of document | |
sets the object on the document | |
Mongoid::Relations::Builders::NestedAttributes::Many | |
#allow_destroy? | |
when the option is provided | |
returns the option | |
when the option is not provided | |
returns false | |
#build | |
when attributes are over limit | |
raises an error | |
when rejectable | |
rejects the matching attributes | |
when ids are present | |
updates existing documents | |
when ids are not present | |
adds new documents | |
#initialize | |
sorts the attributes | |
#reject? | |
when the proc is provided | |
when the proc matches | |
returns true | |
when the proc does not match | |
returns false | |
when the proc is not provided | |
returns false | |
#update_only? | |
when the option is provided | |
returns the option | |
when the option is not provided | |
returns false | |
Mongoid::Relations::Builders::NestedAttributes::One | |
#allow_destroy? | |
when the option is provided | |
returns the option | |
when the option is not provided | |
returns false | |
#build | |
when attributes are rejectable | |
does not change the relation | |
when attributes are updatable | |
updates the relation | |
when attributes are replacable | |
updates the relation | |
when attributes are deletable | |
deletes the relation | |
#destroy | |
when the attribute exists | |
returns the value | |
when the attribute does not exist | |
returns nil | |
#reject? | |
when the proc is provided | |
when the proc matches | |
returns true | |
when the proc does not match | |
returns false | |
when the proc is not provided | |
returns false | |
#update_only? | |
when the option is provided | |
returns the option | |
when the option is not provided | |
returns false | |
Mongoid::Relations::Builders::Referenced::In | |
#build | |
when provided an id | |
when the object is an object id | |
sets the document | |
when the object is an integer | |
sets the document | |
when provided a object | |
returns the object | |
Mongoid::Relations::Builders::Referenced::Many | |
#build | |
when provided an id | |
sets the documents | |
when provided a object | |
returns the object | |
Mongoid::Relations::Builders::Referenced::ManyToMany | |
#build | |
when provided ids | |
sets the documents | |
when provided a object | |
when the object is not nil | |
returns the objects | |
when the object is nil | |
returns the object | |
Mongoid::Relations::Builders::Referenced::One | |
#build | |
when provided an id | |
sets the document | |
when provided a object | |
returns the object | |
Mongoid::Relations::Builders | |
Mongoid::Relations::Cascading::Delete | |
#cascade | |
when the documents exist | |
deletes all documents in the relation | |
when no documents exist | |
does not delete anything | |
Mongoid::Relations::Cascading::Destroy | |
#cascade | |
when the documents exist | |
destroys all documents in the relation | |
when no documents exist | |
does not destroy anything | |
Mongoid::Relations::Cascading::Nullify | |
#cascade | |
nullifies the relation | |
Mongoid::Relations::Cascading | |
.cascade | |
when a dependent option is provided | |
adds the action to the cascades | |
returns self | |
when no dependent option is provided | |
does not add an action to the cascades | |
returns self | |
Mongoid::Relations::Constraint | |
#convert | |
when the id's class stores object ids | |
when provided an object id | |
returns the object id | |
when provided a string | |
returns an object id from the string | |
when the id's class does not store object ids | |
returns the object | |
Mongoid::Relations::Cyclic | |
.recursively_embeds_many | |
creates the parent relation | |
creates the child relation | |
.recursively_embeds_one | |
creates the parent relation | |
creates the child relation | |
Mongoid::Relations::Embedded::In | |
#=== | |
when the proxied document is same class | |
returns true | |
#bind | |
when building | |
does not save the document | |
when not building | |
does not save the target | |
.builder | |
returns the embedded one builder | |
.embedded? | |
returns true | |
#initialize | |
parentizes the child | |
.macro | |
returns embeds_one | |
.nested_builder | |
returns the single nested builder | |
#substitute | |
when passing a document | |
sets a new target | |
returns the relation | |
when passing nil | |
sets a new target | |
returns the relation | |
#unbind | |
when the target is persisted | |
when the base has not been destroyed | |
deletes the base | |
when the base is already destroyed | |
does not delete the target | |
when the target is not persisted | |
does not delete the base | |
Mongoid::Relations::Embedded::Many | |
#<< | |
when the base is persisted | |
appends the document to the target | |
adds the metadata to the target | |
indexes the target | |
when the base is not persisted | |
does not save the target | |
#push | |
when the base is persisted | |
appends the document to the target | |
adds the metadata to the target | |
indexes the target | |
when the base is not persisted | |
does not save the target | |
#concat | |
when the base is persisted | |
appends the document to the target | |
adds the metadata to the target | |
indexes the target | |
when the base is not persisted | |
does not save the target | |
#bind | |
when building | |
does not save the target docs | |
when not building | |
when the base is persisted | |
saves all target docs | |
when the base is not persisted | |
does not save any docs | |
#bind_one | |
binds the document | |
#build | |
appends a new document to the target | |
identifies the document | |
indexes the document | |
sets the parent on the document | |
sets the metadata on the document | |
.builder | |
returns the many builder | |
#count | |
returns the number of persisted documents | |
#create | |
builds and saves a new document | |
#create! | |
when validation passes | |
builds and saves a new document | |
when validation fails | |
raises an error | |
#delete | |
when the document is in the target | |
removes the document from the target | |
reindexes the target | |
returns the matching document | |
when the document is not in the target | |
returns nil | |
#delete_all | |
when conditions are provided | |
removes the matching documents | |
reindexes the target | |
when no conditions are provided | |
removes all documents | |
#destroy_all | |
when conditions are provided | |
removes the matching documents | |
reindexes the target | |
when no conditions are provided | |
removes all documents | |
.embedded? | |
returns true | |
#find | |
when providing an id | |
when the id matches | |
returns the matching document | |
when the id does not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns nil | |
when providing an array of ids | |
when the ids match | |
returns the matching documents | |
when the ids do not match | |
when config set to raise error | |
raises an error | |
when config set not to raise error | |
returns an empty array | |
when finding first | |
when there is a match | |
returns the first matching document | |
when there is no match | |
returns nil | |
when finding last | |
when there is a match | |
returns the last matching document | |
when there is no match | |
returns nil | |
when finding all | |
when there is a match | |
returns the matching documents | |
when there is no match | |
returns an empty array | |
#find_or_create_by | |
when the document exists | |
returns the document | |
when the document does not exist | |
creates the document | |
#find_or_initialize_by | |
when the document exists | |
returns the document | |
when the document does not exist | |
returns a new document | |
.macro | |
returns embeds_many | |
.nested_builder | |
returns the many nested builder class | |
#paginate | |
when provided page and per page options | |
returns the correct number of documents | |
returns the supplied page of documents | |
#substitute | |
when passing documents | |
sets a new target | |
returns the relation | |
when passing nil | |
sets a new target | |
returns the relation | |
#as_document | |
returns an array of document hashes | |
#unbind | |
when the base is persisted | |
when the target has not been destroyed | |
deletes the target | |
when the target is already destroyed | |
does not delete the target | |
when the base is not persisted | |
does not delete the target | |
Mongoid::Relations::Embedded::One | |
#=== | |
when the proxied document is same class | |
returns true | |
#bind | |
when building | |
does not save the document | |
when not building | |
when the base is persisted | |
saves the target | |
when the base is not persisted | |
does not save the target | |
.builder | |
returns the embedded one builder | |
.embedded? | |
returns true | |
#initialize | |
parentizes the child | |
.macro | |
returns embeds_one | |
.nested_builder | |
returns the single nested builder | |
#substitute | |
when passing a document | |
sets a new target | |
returns the relation | |
when passing nil | |
sets a new target | |
returns the relation | |
#unbind | |
when the base is persisted | |
when the target has not been destroyed | |
deletes the target | |
when the target is already destroyed | |
does not delete the target | |
when the base is not persisted | |
does not delete the target | |
Mongoid::Relations::Macros | |
.embedded_in | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
creates the correct relation | |
does not add associated validations | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
.embeds_many | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
creates the correct relation | |
adds an associated validation | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
when setting validate to false | |
does not add associated validations | |
.embeds_one | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
defines the builder | |
defines the creator | |
creates the correct relation | |
adds an associated validation | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
when setting validate to false | |
does not add associated validations | |
.referenced_in | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
creates the correct relation | |
creates the field for the foreign key | |
does not add associated validations | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
.references_many | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
creates the correct relation | |
adds an associated validation | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
when setting validate to false | |
does not add associated validations | |
.references_and_referenced_in_many | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
creates the correct relation | |
creates the field for the foreign key | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
.references_one | |
defines the macro | |
when defining the relation | |
adds the metadata to the klass | |
defines the getter | |
defines the setter | |
defines the builder | |
defines the creator | |
creates the correct relation | |
adds an associated validation | |
metadata properties | |
automatically adds the name | |
automatically adds the inverse class name | |
when setting validate to false | |
does not add associated validations | |
#relations | |
returns a hash of relations | |
has keys that are the relation name | |
has values that are metadata | |
.relations | |
returns a hash of relations | |
has keys that are the relation name | |
has values that are metadata | |
Mongoid::Relations::Metadata | |
#builder | |
returns the builder from the relation | |
#cascade_strategy | |
when no dependent option is set | |
returns nil | |
when dependent is delete | |
returns the delete strategy | |
when dependent is destroy | |
returns the destroy strategy | |
when dependent is nullify | |
returns the nullify strategy | |
#constraint | |
returns the constraint object | |
#class_name | |
when class_name provided | |
constantizes the class name | |
when no class_name provided | |
when association name is singular | |
classifies and constantizes the association name | |
when association name is plural | |
classifies and constantizes the association name | |
#embedded? | |
when the relation is embedded | |
returns true | |
when the relation is not embedded | |
returns false | |
#extension | |
returns the extend property | |
#extension? | |
when an extends property exists | |
returns true | |
when the extend option is nil | |
returns false | |
#foreign_key | |
when no foreign key was explicitly defined | |
when the relation stores a foreign key | |
when referenced in | |
when not providing a class name | |
returns the foreign_key | |
when providing a class name | |
returns the foreign_key | |
when the class is namespaces | |
returns the foreign_key without the module name | |
when references and referenced in many | |
returns the foreign_key | |
given a specific foreign key | |
returns the foreign_key | |
using name as foreign key | |
returns the foreign_key | |
when the relation does not store a foreign key | |
when references one | |
returns the inverse foreign key | |
when references many | |
when an inverse_of is defined | |
returns the inverse_of plus suffix | |
when the class is not namespaced | |
returns the inverse foreign key | |
when the class is namespaced | |
returns the foreign_key without the module name | |
when a foreign_key was defined | |
returns the foreign_key | |
#foreign_key_default | |
when the relation stores keys in an array | |
returns an empty array | |
when the relation stores a single key | |
returns an empty array | |
#foreign_key_setter | |
when the relation is not polymorphic | |
returns the foreign_key plus = | |
when the relation is polymorphic | |
returns the polymorphic foreign_key plus = | |
#inspect | |
contains all relevant information | |
#inverse_type | |
when the relation is not polymorphic | |
returns nil | |
when the relation is polymorphic | |
returns the polymorphic name plus type | |
#inverse_type_setter | |
when the relation is not polymorphic | |
returns nil | |
when the relation is polymorphic | |
returns the inverse type plus = | |
#indexed? | |
when an index property exists | |
returns true | |
when the index option is nil | |
returns false | |
when the index option is false | |
returns false | |
#inverse | |
when an inverse relation exists | |
when inverse_of is defined | |
returns the name of the inverse_of property | |
when not polymorphic | |
returns the name of the relation | |
when polymorphic | |
returns the name of the relation | |
when polymorphic on the child | |
returns the name of the relation | |
when in a cyclic relation | |
returns the name of the relation | |
#inverse_foreign_key | |
when the inverse foreign key is not defined | |
returns the inverse class name plus suffix | |
#inverse_klass | |
constantizes the inverse_class_name | |
#inverse_setter | |
when the relation is not polymorphic | |
returns a string for the setter | |
when the relation is polymorphic | |
when a referenced in | |
returns a string for the setter | |
when a references many | |
returns a string for the setter | |
#key | |
when relation is embedded | |
returns the name as a string | |
when relation is referenced | |
when relation stores foreign_key | |
when the relation is not polymorphic | |
returns the foreign_key | |
when the relation is polymorphic | |
returns the polymorphic foreign_key | |
when relation does not store a foreign_key | |
returns _id | |
#klass | |
constantizes the class_name | |
#macro | |
returns the macro from the relation | |
#nested_builder | |
returns the nested builder from the relation | |
properties | |
#autosave | |
returns the autosave property | |
#autosave? | |
when a autosave property exists | |
returns true | |
when the autosave property is nil | |
returns false | |
#cyclic | |
returns the cyclic property | |
#cyclic? | |
when a cyclic property exists | |
returns true | |
when the cyclic property is nil | |
returns false | |
#dependent | |
returns the dependent property | |
#dependent? | |
when a dependent property exists | |
returns true | |
when the dependent property is nil | |
returns false | |
#inverse_class_name | |
returns the inverse_class_name property | |
#inverse_class_name? | |
when a inverse_class_name property exists | |
returns true | |
when the inverse_class_name property is nil | |
returns false | |
#inverse_of | |
returns the inverse_of property | |
#inverse_of? | |
when a inverse_of property exists | |
returns true | |
when the inverse_of property is nil | |
returns false | |
#name | |
returns the name property | |
#name? | |
when a name property exists | |
returns true | |
when the name property is nil | |
returns false | |
#polymorphic | |
returns the polymorphic property | |
#polymorphic? | |
when a polymorphic property exists | |
returns true | |
when the polymorphic property is nil | |
returns false | |
#relation | |
returns the relation property | |
#relation? | |
when a relation property exists | |
returns true | |
when the relation property is nil | |
returns false | |
#order | |
returns the order property | |
#order? | |
when a order property exists | |
returns true | |
when the order property is nil | |
returns false | |
Mongoid::Relations::Polymorphic | |
#polymorph | |
when the relation is polymorphic | |
when the relation stores a foreign key | |
sets polymorphic to true | |
adds the foreign key type field | |
returns self | |
when the relation does not store a foreign key | |
sets polymorphic to true | |
does not add the foreign key type field | |
when the relation is not polymorphic | |
sets polymorphic to false | |
does not add the foreign key type field | |
.polymorphic? | |
when the document is in a polymorphic relation | |
returns true | |
when the document is not in a polymorphic relation | |
returns false | |
#polymorphic? | |
when the document is in a polymorphic relation | |
returns true | |
when the document is not in a polymorphic relation | |
returns false | |
Mongoid::Relations::Referenced::In | |
.builder | |
returns the embedded in builder | |
.embedded? | |
returns false | |
.foreign_key_suffix | |
returns _id | |
.macro | |
returns referenced_in | |
.stores_foreign_key? | |
returns true | |
Mongoid::Relations::Referenced::Many | |
.builder | |
returns the embedded in builder | |
.embedded? | |
returns false | |
.foreign_key_suffix | |
returns _id | |
.macro | |
returns references_many | |
.stores_foreign_key? | |
returns false | |
Mongoid::Relations::Referenced::ManyToMany | |
.builder | |
returns the embedded in builder | |
.embedded? | |
returns false | |
.foreign_key_suffix | |
returns _ids | |
.macro | |
returns references_and_referenced_in_many | |
.stores_foreign_key? | |
returns true | |
Mongoid::Relations::Referenced::One | |
.builder | |
returns the embedded in builder | |
.embedded? | |
returns false | |
.foreign_key_suffix | |
returns _id | |
.macro | |
returns references_one | |
.stores_foreign_key? | |
returns false | |
Mongoid::Relations::Reflections | |
.reflect_on_association | |
when the name exists | |
returns the association metadata | |
when the name does not exist | |
returns nil | |
.reflect_on_all_associations | |
when relations exist for the macros | |
when passing multiple arguments | |
returns an array of the relations | |
when passing a single argument | |
returns an array of the relations | |
when no relations exist for the macros | |
returns an empty array | |
when no argument supplied | |
returns an empty array | |
Mongoid::Relations | |
#embedded? | |
when the document has a parent | |
returns true | |
when the document has no parent | |
when the document is embedded in | |
returns true | |
when the document class is not embedded in | |
returns false | |
#embedded_many? | |
when the document is in an embeds_many | |
returns true | |
when the document is not in an embeds_many | |
returns false | |
#embedded_one? | |
when the document is in an embeds_one | |
returns true | |
when the document is not in an embeds_one | |
returns false | |
#referenced_many? | |
when the document is in an references_many | |
returns true | |
when the document is not in an references_many | |
returns false | |
#referenced_one? | |
when the document is in an references_one | |
returns true | |
when the document is not in an references_one | |
returns false | |
Mongoid::Safety | |
.safely | |
default | |
returns a safe proxy | |
proxies the class | |
defaults the safety options to true | |
with options | |
returns a safe proxy | |
proxies the class | |
stores the safety options | |
#safely | |
default | |
returns a safe proxy | |
proxies the document | |
defaults the safety value to true | |
with options | |
returns a safe proxy | |
proxies the class | |
stores the safety options | |
when proxying a document instance | |
when using default safety level | |
behaves like a safely persisting document instance | |
#delete | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#destroy | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#inc | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#insert | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#save! | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#update | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#update_attributes | |
without options provided | |
sends the safe mode option to the command | |
#update_attributes | |
without options provided | |
sends the safe mode option to the command | |
#upsert | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
when using specified safety level | |
behaves like a safely persisting document instance | |
#delete | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#destroy | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#inc | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#insert | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#save! | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#update | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
#update_attributes | |
without options provided | |
sends the safe mode option to the command | |
#update_attributes | |
without options provided | |
sends the safe mode option to the command | |
#upsert | |
without options provided | |
sends the safe mode option to the command | |
with options provided | |
sends the safe mode option to the command | |
when proxying a class | |
when using default safety level | |
behaves like a safely persisting class | |
#create | |
without attributes provided | |
sends the safe mode option to the command | |
with attributes provided | |
sends the safe mode option to the command | |
#create! | |
without attributes provided | |
sends the safe mode option to the command | |
with attributes provided | |
sends the safe mode option to the command | |
#delete_all | |
without conditions provided | |
sends the safe mode option to the command | |
with conditions provided | |
sends the safe mode option to the command | |
#destroy_all | |
without onditions provided | |
sends the safe mode option to the command | |
with conditions provided | |
sends the safe mode option to the command | |
when using a specified safety level | |
behaves like a safely persisting class | |
#create | |
without attributes provided | |
sends the safe mode option to the command | |
with attributes provided | |
sends the safe mode option to the command | |
#create! | |
without attributes provided | |
sends the safe mode option to the command | |
with attributes provided | |
sends the safe mode option to the command | |
#delete_all | |
without conditions provided | |
sends the safe mode option to the command | |
with conditions provided | |
sends the safe mode option to the command | |
#destroy_all | |
without onditions provided | |
sends the safe mode option to the command | |
with conditions provided | |
sends the safe mode option to the command | |
Mongoid::Scope | |
.initialize | |
stores the provided conditions | |
when a block is passed in | |
it stores the extensions | |
#extend | |
without any extensions | |
does nothing | |
with extensions | |
extends the criteria | |
Mongoid::Document | |
Mongoid::State | |
#new? | |
when calling new on the document | |
returns true | |
when the object has been saved | |
returns false | |
when the object has not been saved | |
returns true | |
#new_record? | |
when calling new on the document | |
returns true | |
when the object has been saved | |
returns false | |
when the object has not been saved | |
returns true | |
#persisted? | |
delegates to new_record? | |
destroyed? | |
when destroyed is true | |
returns true | |
when destroyed is false | |
returns true | |
when destroyed is nil | |
returns false | |
Mongoid::Timestamps | |
.included | |
adds created_at to the document | |
adds updated_at to the document | |
forces the created_at timestamps to UTC | |
forces the updated_at timestamps to UTC | |
includes a record_timestamps class_accessor to ease AR compatibility | |
Mongoid::Validations::AssociatedValidator | |
#validate_each | |
when the association is a has one | |
when the association is nil | |
adds no errors | |
when the association is valid | |
adds no errors | |
when the association is invalid | |
adds errors to the parent document | |
translates the error in english | |
when the association is a has many | |
when the association is empty | |
adds no errors | |
when the association has invalid documents | |
adds errors to the parent document | |
when the assocation has all valid documents | |
adds no errors | |
Mongoid::Validations::UniquenessValidator | |
#validate_each | |
when a document exists with the attribute value | |
adds the errors to the document | |
should translate the error in english | |
when a superclass document exists with the attribute value | |
adds the errors to the document | |
when no other document exists with the attribute value | |
adds no errors | |
when defining a single field key | |
when a document exists in the db with the same key | |
when the document being validated is new | |
checks the value of the key field | |
when the document being validated is not new | |
when the id has not changed since instantiation | |
checks the value of the key field | |
when the id has changed since instantiation | |
checks the value of the key field | |
#validate_each with embedded document | |
embeds_many | |
excludes by attribute and id | |
embeds_one | |
no validations are run | |
when document has no parent | |
no validations are run | |
#validate_each with :scope option given | |
as a symbol | |
should query only scoped documents | |
as an array | |
should query only scoped documents | |
#validate_each with case sensitive true | |
when a document exists with the attribute value | |
adds the errors to the document | |
should translate the error in english | |
when a superclass document exists with the attribute value | |
adds the errors to the document | |
when no other document exists with the attribute value | |
adds no errors | |
when defining a single field key | |
when a document exists in the db with the same key | |
when the document being validated is new | |
checks the value of the key field | |
when the document being validated is not new | |
when the id has not changed since instantiation | |
checks the value of the key field | |
when the id has changed since instantiation | |
checks the value of the key field | |
#validate_each with case sensitive false | |
when a document exists with the attribute value | |
adds the errors to the document | |
should translate the error in english | |
when a superclass document exists with the attribute value | |
adds the errors to the document | |
when no other document exists with the attribute value | |
adds no errors | |
when defining a single field key | |
when a document exists in the db with the same key | |
when the document being validated is new | |
checks the value of the key field | |
when the document being validated is not new | |
when the id has not changed since instantiation | |
checks the value of the key field | |
when the id has changed since instantiation | |
checks the value of the key field | |
#validate_each with embedded document | |
embeds_many | |
excludes by attribute and id | |
embeds_one | |
no validations are run | |
when document has no parent | |
no validations are run | |
#validate_each with :scope option given | |
as a symbol | |
should query only scoped documents | |
as an array | |
should query only scoped documents | |
Mongoid::Validations | |
#read_attribute_for_validation | |
when reading a field | |
returns the value | |
when reading a relation | |
returns the value | |
.validates_associated | |
adds the associated validator | |
is picked up by validates method | |
.validates_uniqueness_of | |
adds the uniqueness validator | |
is picked up by validates method | |
Mongoid::Versioning | |
.max_versions | |
when provided an integer | |
sets the class version max | |
when provided a string | |
sets the class version max | |
#revise | |
when a last version does not exist | |
does not add any versions | |
when a last version exists | |
does not add any versions | |
Mongoid | |
.configure | |
when no block supplied | |
returns the config singleton | |
when a block is supplied | |
sets the values on the config instance | |
Rails::Mongoid | |
.load_models | |
when all models are in the models directory | |
requires the models by basename | |
when models exist in subdirectories | |
requires the models by subdirectory and basename | |
Pending: | |
Mongoid::Relations::Builders::Referenced::ManyToMany#build Github 246: Should return documents in same order as ids | |
# Not Yet Implemented | |
# ./spec/integration/mongoid/relations/builders/referenced/many_to_many_spec.rb:32 | |
Mongoid::Persistence::Update#persist when the document is changed when the document is a tree | |
# Not Yet Implemented | |
# ./spec/unit/mongoid/persistence/update_spec.rb:155 | |
Finished in 25.49 seconds | |
3500 examples, 0 failures, 2 pending | |
~/hack/mongoid@master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment