123456789_123456789_123456789_123456789_123456789_

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:
Instance Chain:
Inherits: ActiveModel::Attribute
Defined in: activemodel/lib/active_model/attribute.rb

Class Method Summary

::ActiveModel::Attribute - Inherited

.from_database, .from_user,
.new

This method should not be called directly.

.null, .uninitialized, .with_cast_value

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name) ⇒ Null

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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

[ GitHub ]

  
# 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)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attribute.rb', line 238

alias_method :with_value_from_user, :with_value_from_database