Class: Mongoid::Field
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Field
constructor
Create the new field with a name and optional additional options.
Constructor Details
#initialize(name, options = {}) ⇒ Field
Create the new field with a name and optional additional options. Valid options are :default
Options:
name: The name of the field as a Symbol
. options: A Hash
of options for the field.
Example:
Field.new(:score, :default => 0)
19 20 21 22 |
# File 'lib/mongoid/field.rb', line 19 def initialize(name, = {}) @name = name @default = [:default] end |