Module

AttributeMethods

There's no documentation for this item.

Modules
ClassMethods Declare and check for suffixed attribute methods.
Constants
ATTRIBUTE_TYPES_CACHED_BY_DEFAULT
DEFAULT_SUFFIXES
Aliases
respond_to_without_attributes? A Person object with a name attribute can ask person.respond_to?("name"), person.respond_to?("name="), and person.respond_to?("name?") which will all return true.
Public Methods
included
method_missing Allows access to the object attributes, which are held in the @attributes hash, as though they were first-class methods. So a Person class with a name attribute can use Person#name and Person#name= and never directly use the attributes hash — except for multiple assigns with ActiveRecord#attributes=. A Milestone class can also ask Milestone#completed? to test that the completed attribute is not nil or 0.
query_attribute
read_attribute Returns the value of the attribute identified by attr_name after it has been typecast (for example, "2004-12-12" in a data column is cast to a date object, like Date.new(2004, 12, 12)).
read_attribute_before_type_cast
respond_to?
unserializable_attribute? Returns true if the attribute is of a text column and marked for serialization.
unserialize_attribute Returns the unserialized object of the attribute.
write_attribute Updates the attribute identified by attr_name with the specified value. Empty strings for fixnum and float columns are turned into nil.
Private Methods
attribute= Handle *= for method_missing.
attribute? Handle *? for method_missing.
attribute_before_type_cast Handle *_before_type_cast for method_missing.
missing_attribute
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.