Object-Relational Mapping and the Beauty of Active Record

The Benefits of Active Record

Typically, data is the most important aspect of a web application. Naturally, how we handle that data should be of much importance. Active Record is a gem that will make our lives so much easier. It can give us the ability to structure data and models for our users in a plain and easy-to-understand way. Moreover, it provides us a plethora of different functionalities, such as representing data, performing database functions, validating models before they are persisted to the database and so much more. Take another look at the code above, and then take a look at the code below.

Inherit from ActiveRecord::Base in your model class

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store