Aktuelle Änderungen Printable View Änderungen Bearbeiten
> AllRecentChanges > HomePage > ADO > ActiveXDataObjects > ANTLR > AST > AbstractSyntaxTrees > AaronSwartz > AbstractDataType > OopVsAdt > AbstractDataTypes > AbstractDataType > AbstractSyntaxTree > AbstractSyntaxTrees > ActiveRecordClear TrailAn object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.[1]
Active record is an approach to reading data from a database. A row in a database table or view is wrapped into a class, thus an object instance is tied to a single row in the database. When an object is created, a new row will be added to the database when it's saved. When an object is loaded, it gets its information from the database, when it's updated, the row in the database gets updated. The wrapper class implements accessor methods for each column in the table or view.
record = table_name(id_of_some_row) record.column_name = some_value record.save()
ActiveRecord creates the mapping at runtime, which is possible because it's running in a dynamic language, all of which means that I can add a column to some table and then just program with it. [2]