TypecastedAttributes¶
TypecastedAttributes allows types to be declared for your attributes
Types are declared by passing the :type option to the attribute class method. After a type is declared, attribute readers will convert any assigned attribute value to the declared type. If the assigned value cannot be cast, nil will be returned instead. You can access the original assigned value using the before_type_cast methods.
See {Typecasting} for the currently supported types.
Originally part of ActiveAttr, https://github.com/cgriego/active_attr
Constants¶
- DEPRECATED_OBJECT_METHODS
Methods¶
- #[]=
Write a single attribute to the model’s attribute hash.
def write_attribute(name, value) if respond_to? "#{name}=" send "#{name}=", value else fail Neo4j::UnknownAttributeError, "unknown attribute: #{name}" end end