DEV Community

Cover image for What is Active Record? (Quick Intro)
Aweys Ahmed
Aweys Ahmed

Posted on

What is Active Record? (Quick Intro)

In this blog post, I'll introduce you to Active Record which is used in the Rails framework.

Ruby on Rails uses a software design pattern called Model-View-Controller (MVC) and Active Record is part of the model in MVC. This means that Active Records works with your database.

Object Relational Mapping (ORM)

Active Record is an ORM. Using an ORM allows a developer to use the language they are working with to query a database without having to use MySQL, PostgreSQL or other databases query commands.

Active record maps the class name to a table in a database and each row to an instance of the class.

This is part one of the intro into Active Record and it will be a series. The following blog posts in this series will cover.

  • Intro Part II
  • Migrations
  • Validations
  • Callbacks
  • Associations
  • Queries

So far what you need to know about Active Record is that it is an ORM. It allows you to interact with a database using the language that you are building your application with.

In part two, we will look at some examples of how Active Record allows you to interact with your database.

Top comments (0)