Class: ActiveModel::Attribute::Null
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveModel::Attribute
|
|
Instance Chain:
self,
::ActiveModel::Attribute
|
|
Inherits: |
ActiveModel::Attribute
|
Defined in: | activemodel/lib/active_model/attribute.rb |
Class Method Summary
- .new(name) ⇒ Null constructor
::ActiveModel::Attribute
- Inherited
.from_database, .from_user, | |
.new | This method should not be called directly. |
.null, .uninitialized, .with_cast_value |
Instance Attribute Summary
::ActiveModel::Attribute
- Inherited
Instance Method Summary
- #type_cast
-
#with_cast_value(value)
Alias for #with_value_from_database.
- #with_type(type)
- #with_value_from_database(value) (also: #with_value_from_user, #with_cast_value)
-
#with_value_from_user(value)
Alias for #with_value_from_database.
::ActiveModel::Attribute
- Inherited
Constructor Details
.new(name) ⇒ Null
# File 'activemodel/lib/active_model/attribute.rb', line 223
def initialize(name) super(name, nil, Type.default_value) end
Instance Method Details
#type_cast
[ GitHub ]# File 'activemodel/lib/active_model/attribute.rb', line 227
def type_cast(*) nil end
#with_cast_value(value)
Alias for #with_value_from_database.
# File 'activemodel/lib/active_model/attribute.rb', line 239
alias_method :with_cast_value, :with_value_from_database
#with_type(type)
[ GitHub ]# File 'activemodel/lib/active_model/attribute.rb', line 231
def with_type(type) self.class.with_cast_value(name, nil, type) end
#with_value_from_database(value) Also known as: #with_value_from_user, #with_cast_value
# File 'activemodel/lib/active_model/attribute.rb', line 235
def with_value_from_database(value) raise ActiveModel::MissingAttributeError, "can't write unknown attribute `#{name}`" end
#with_value_from_user(value)
Alias for #with_value_from_database.
# File 'activemodel/lib/active_model/attribute.rb', line 238
alias_method :with_value_from_user, :with_value_from_database