What is Active Record as an ORM framework in ROR?
Active Record is a part of the
ORM - Object Relational Mapping provides a variety of frameworks and techniques that are helpful in working with Relational Databases such as MySQL, PostgreSQL, etc.
“Active record - an object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.” ~ M. Fowler
Active Record provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records.
Each Active Record object has
Mapping in ORM
The ORM uses the data in this
In the ORM database, tables become classes, fields become attributes, and instances of the database are mapped to class objects.
Key points
Active Record provides several mechanisms to work with. Some interesting abilities include:
- Representing models of the data.
- Representing associations between models
- Representing inheritance hierarchies through related models
- Validating data before it is made a persistent entry in the database
- Performing database operations in an object-oriented fashion
Free Resources