Module: Mongoid::FieldReadable Private
- Included in:
- Association::Referenced::HasMany::Enumerable, Contextual::Aggregable::Memory, Contextual::Memory
- Defined in:
- lib/mongoid/field_readable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Reads the value of a field name from a document without dispatching the name as an arbitrary method.
Field names may come from application input, where a name like destroy
or attributes would delete the document or disclose its contents.
Declared field and association names are validated when they are declared
(see Mongoid.destructive_fields), so a name that resolves to one of them
is safe to send to a document. Any other name is read from the attributes
hash, which is what the database-backed query contexts do.